LLMS_REST_Enrollments_Controller::handle_creation_date_update( integer $student_id, integer $post_id, string $date )

Handles the enrollment creation date.


Parameters Parameters

$student_id

(integer) (Required) Student id.

$post_id

(integer) (Required) The post id.

$date

(string) (Required) Creation date.


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php

				// The default trigger for the `LLMS_Student::enroll()` method is 'unspecified'.
				$trigger = $trigger && 'any' !== $trigger ? $trigger : 'unspecified';
				$updated = $student->enroll( $post_id, $trigger );
				break;
			default:
				$updated = $student->unenroll( $post_id, $trigger, $status );
		endswitch;

		return $updated;

	}


	/**
	 * Handles the enrollment creation date.
	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.4 Fixed call to undefined function `llms_bad_request_error()`, must be `llms_rest_bad_request_error()`.
	 *
	 * @param integer $student_id Student id.
	 * @param integer $post_id    The post id.
	 * @param string  $date       Creation date.
	 * @return boolean
	 */
	protected function handle_creation_date_update( $student_id, $post_id, $date ) {

		$date_created = rest_parse_date( $date );

		if ( ! $date_created ) {
			return llms_rest_bad_request_error();
		}

		$date_created = date_i18n( 'Y-m-d H:i:s', $date_created );


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.4 Fixed call to undefined function llms_bad_request_error(), must be llms_rest_bad_request_error().
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.