Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Meta_Box_Award_Engagement_Submit::current_student_id( null|bool $creating = null )

Retrieve the current student id.

Parameters Parameters


(null|bool) (Optional) Whether or not we're awarding an engagement. If not provided, it'll be dynamically retrieved if the current screen's action is 'add'. See WordPress' get_current_screen().

Default value: null

Top ↑

Return Return


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/

	private function current_student_id( $creating = null ) {

		if ( isset( $this->student_id ) ) {
			return $this->student_id;

		$creating  = $creating ?? ( 'add' === get_current_screen()->action );
		$post_type = get_post_type( $this->post->ID );
		// If creating, take into account passed GET variable.
		$student = $creating && ! empty( $_GET['sid'] ) ? llms_filter_input( INPUT_GET, 'sid', FILTER_SANITIZE_NUMBER_INT ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no need to verify the nonce here.
		// If not creating, retrieve the earned engagement user id.
		$student          = ! $creating ? ( new $this->post_types[ $post_type ]['model']( $this->post->ID ) )->get_user_id() : $student;
		$this->student_id = $student;

		return $this->student_id;


Top ↑

Changelog Changelog

Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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