LLMS_Course_Data::get_engagements( string $type, string $period = 'current' )

Retrieve # of engagements related to the course awarded within the period


Description Description


Parameters Parameters

$type

(string) (Required) engagement type [email|certificate|achievement]

$period

(string) (Optional) date period [current|previous]

Default value: 'current'


Top ↑

Return Return

(int)


Top ↑

Source Source

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

	public function get_engagements( $type, $period = 'current' ) {

		global $wpdb;

		$ids = implode( ',', $this->get_all_ids() );

		return $wpdb->get_var( $wpdb->prepare( "
			SELECT DISTINCT COUNT( user_id )
			FROM {$wpdb->prefix}lifterlms_user_postmeta
			WHERE meta_key = %s
			  AND post_id IN ( {$ids} )
			  AND updated_date BETWEEN %s AND %s
			",
			'_' . $type,
			$this->get_date( $period, 'start' ),
			$this->get_date( $period, 'end' )
		) );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.15.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: