dozent_get_wishlist_courses( null $user = null )

Get wishlist courses by specific user


Description

See also


Parameters

$user

(null) (Optional) User Object or ID

Default value: null


Return

(bool|WP_Query)


Source

File: includes/course-functions.php

	function dozent_get_wishlist_courses( $user = null ) {
		$user    = dozent_user_data( $user );
		$user_id = $user->get_id();

		$course_ids = (array) get_user_meta( $user_id, '_dozent_course_wishlist' );

		if ( dozent_count( $course_ids ) ) {

			$paged = ( dozent_input_text( 'current_page' ) ) ? (int) dozent_input_text( 'current_page' ) : 1;

			$per_page = dozent_show_per_page();

			$course_args = [
				'post_type'      => 'dozent_course',
				'post_status'    => 'publish',
				'post__in'       => $course_ids,
				//'posts_per_page' => - 1,
				'posts_per_page' => $per_page,
				'paged'          => $paged
			];

			return new \WP_Query( $course_args );
		}

		return false;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.