LLMS_Notifications_Query::prepare_query()

Prepare the SQL for the query.


Return Return

(string)


Top ↑

Source Source

File: includes/notifications/class.llms.notifications.query.php

	protected function prepare_query() {

		global $wpdb;

		$from  = "FROM {$wpdb->prefix}lifterlms_notifications AS n";
		$join  = "LEFT JOIN {$wpdb->posts} AS p on p.ID = n.post_id";
		$where = $this->sql_where();

		if ( ! $this->get( 'no_found_rows' ) ) {
			$this->count_query = "SELECT COUNT(*) {$from} {$join} {$where}";
		}

		$vars = array(
			$this->get_skip(),
			$this->get( 'per_page' ),
		);

		// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- SQL is prepared in other functions.
		$sql = $wpdb->prepare(
			"SELECT {$this->sql_select_columns()}
			{$from}
			{$join}
			{$where}
			{$this->sql_orderby()}
			LIMIT %d, %d
			;",
			$vars
		);
		// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared

		return $sql;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.1.0 Use $this->sql_select_columns({columns}) to determine the columns to select.
6.0.0 Renamed from preprare_query().
3.9.4 Unknown.
3.8.0
10.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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