LLMS_Controller_Admin_Quiz_Attempts::maybe_run_actions()

Run actions on form submission


Description Description


Return Return

(void)


Top ↑

Source Source

File: includes/controllers/class.llms.controller.admin.quiz.attempts.php

	public function maybe_run_actions() {

		if ( ! llms_verify_nonce( '_llms_quiz_attempt_nonce', 'llms_quiz_attempt_actions', 'POST' ) ) {
			return;
		}

		if ( isset( $_POST['llms_quiz_attempt_action'] ) && isset( $_POST['llms_attempt_id'] ) ) {

			$action = $_POST['llms_quiz_attempt_action'];

			$attempt = new LLMS_Quiz_Attempt( absint( $_POST['llms_attempt_id'] ) );

			if ( ! current_user_can( 'edit_post', $attempt->get( 'quiz_id' ) ) ) {
				return;
			}

			if ( 'llms_attempt_delete' === $action ) {
				$url = add_query_arg( array(
					'page' => 'llms-reporting',
					'tab' => 'quizzes',
					'quiz_id' => $attempt->get( 'quiz_id' ),
					'stab' => 'attempts',
				), admin_url( 'admin.php' ) );
				$attempt->delete();
				wp_safe_redirect( $url );
			} elseif ( 'llms_attempt_grade' === $action && ( isset( $_POST['remarks'] ) || isset( $_POST['points'] )) ) {
				$this->save_grade( $attempt );
			}
		}

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.16.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: