dozent_get_rating_by_user( int $course_ID, int $user_ID,  $output = OBJECT )

Get the course rating by user ID


Description

This function return a course rating given by an user. You need to pass the course ID and userID as parameter.

Example usage:

dozent_get_rating_by_user( $course_ID, $user_ID );
dozent_get_rating_by_user( $course_ID, $user_ID, ARRAY_A );

Note: Will always return NULL if there is no rating associated with user and course.

See also


Parameters

$course_ID

(int) (Required) Course ID

$user_ID

(int) (Required) User ID


Return

(array|object|void|null) weather result should be in array or Object


Source

File: includes/core-functions.php

	function dozent_get_rating_by_user( $course_ID = 0, $user_ID = 0, $output = OBJECT ) {
		global $wpdb;

		$course_ID = dozent_get_post_id( $course_ID );
		$user_ID   = dozent_get_user_id( $user_ID );

		$review = $wpdb->get_row( "SELECT * FROM {$wpdb->dozent_reviews} WHERE user_id = {$user_ID} AND course_id = {$course_ID} ", $output );

		return $review;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.