LLMS_Processor_Course_Data::schedule_calculation( int $course_id, int $time = null )

Schedule a calculation to execute

Description Description

This will schedule an event that will setup the queue of items for the background process.

Top ↑

Parameters Parameters


(int) (Required) WP Post ID of the course.


(int) (Optional) y pass a timestamp for when the event should be run.

Default value: null

Top ↑

Return Return


Top ↑

Source Source

File: includes/processors/class.llms.processor.course.data.php

	public function schedule_calculation( $course_id, $time = null ) {

		$course_id = absint( $course_id );

		$this->log( sprintf( 'Course data calculation triggered for course %d.', $course_id ) );

		$args = array( $course_id );

		if ( ! wp_next_scheduled( $this->schedule_hook, $args ) ) {

			$time = ! $time ? time() : $time;

			wp_schedule_single_event( $time, $this->schedule_hook, $args );
			$this->log( sprintf( 'Course data calculation scheduled for course %d.', $course_id ) );



Top ↑

Changelog Changelog

Version Description
4.21.0 Force $course_id to an absolute integer to avoid duplicate scheduling resulting from loose variable typing.
3.15.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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