LLMS_REST_Students_Controller::get_objects_query_pre( WP_User_Query $query )

Callback for WP_User_Query “pre_user_query” action.


Description Description

Adds select fields and a having clause to check against enrolled_in and enrolled_not_in collection query args.


Top ↑

Parameters Parameters

$query

(WP_User_Query) (Required) Query object.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-students-controller.php

			}
		}

		if ( ! empty( $this->prepared_query_args['enrolled_not_in'] ) ) {
			foreach ( $this->prepared_query_args['enrolled_not_in'] as $post_id ) {
				$post_id              = absint( $post_id );
				$query->query_fields .= ", {$this->get_objects_query_status_subquery( $post_id )}";
				$query->query_where  .= " AND (  p_{$post_id}_stat IS NULL OR  p_{$post_id}_stat != 'enrolled' )";
			}
		}

	}

	/**
	 * Generates a subquery to check a user's enrollment status for a given course or membership.
	 *
	 * @since 1.0.0-beta.1
	 *
	 * @param int $post_id Course or membership id.
	 * @return string
	 */


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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