LLMS_Analytics::get_total_certs_issued( $product_id )


Description Description


Source Source

File: includes/class.llms.analytics.php

	public static function get_total_certs_issued( $product_id ) {
		global $wpdb;

		$table_name = $wpdb->prefix . 'lifterlms_user_postmeta';

		if ( 'all_courses' === $product_id ) {
			$results = $wpdb->get_results(
				'SELECT *
					from ' . $table_name . '
					where meta_key = "_certificate_earned"'
			);

		} else {
			$results = $wpdb->get_results(
				$wpdb->prepare(
					'SELECT *
						from ' . $table_name . '
						where meta_key = "_certificate_earned"
						AND post_id = %s', $product_id
				)
			);
		}

		if ( $results ) {
			return count( $results );
		} else {
			return 0;
		}

	}


Top ↑

User Contributed Notes User Contributed Notes

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