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_Controller_Lesson_Progression::get_lesson_id_from_form_data( tring $action )

Retrieve a lesson ID from form data for the mark complete / incomplete forms


Parameters Parameters

$action

(tring) (Required) Form action, either "complete" or "incomplete".


Top ↑

Return Return

(int|null) Returns null when either required post fields are missing or if the lesson_id is non-numeric, int (lesson id) on success.


Top ↑

Source Source

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

	private function get_lesson_id_from_form_data( $action ) {

		if ( ! llms_verify_nonce( '_wpnonce', 'mark_' . $action, 'POST' ) ) {
			return null;
		}

		$submitted = llms_filter_input( INPUT_POST, 'mark_' . $action );
		$lesson_id = llms_filter_input( INPUT_POST, 'mark-' . $action );

		// Required fields.
		if ( is_null( $submitted ) || is_null( $lesson_id ) ) {
			return null;
		}

		$lesson_id = absint( $lesson_id );

		// Invalid lesson ID.
		if ( ! $lesson_id || ! is_numeric( $lesson_id ) ) {

			llms_add_notice( __( 'An error occurred, please try again.', 'lifterlms' ), 'error' );
			return null;

		}

		return $lesson_id;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.29.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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