LLMS_Controller_Lesson_Progression::handle_admin_managment_forms()

Handle form submission from the Student -> Courses -> Course table where admins can toggle completion of lessons for a student.


Return Return

(void)


Top ↑

Source Source

File: includes/controllers/class.llms.controller.lesson.progression.php

	public function handle_admin_managment_forms() {

		if ( ! llms_verify_nonce( 'llms-admin-progression-nonce', 'llms-admin-lesson-progression', 'POST' ) ) {
			return;
		}

		$action     = llms_filter_input( INPUT_POST, 'llms-lesson-action' );
		$lesson_id  = absint( llms_filter_input( INPUT_POST, 'lesson_id' ) );
		$student_id = absint( llms_filter_input( INPUT_POST, 'student_id' ) );

		// Missing required data.
		if ( empty( $action ) || empty( $lesson_id ) || empty( $student_id ) || ! current_user_can( 'edit_post', $lesson_id ) ) {
			return;
		}

		$trigger = 'admin_' . get_current_user_id();

		if ( 'complete' === $action ) {
			$this->mark_complete( $student_id, $lesson_id, $trigger );
		} elseif ( 'incomplete' === $action ) {
			llms_mark_incomplete( $student_id, $lesson_id, 'lesson', $trigger );
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.10.0 Check the current user can edit the lesson they're going to mark complete/incomplete.
5.9.0 Stop using deprecated FILTER_SANITIZE_STRING.
3.29.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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