BP_Recursive_Query::get_sql_clauses()

Generate SQL clauses to be appended to a main query.

Description

Extending classes should call this method from within a publicly accessible get_sql() method, and manipulate the SQL as necessary. For example, BP_XProfile_Query::get_sql() is merely a wrapper for get_sql_clauses(), while BP_Activity_Query::get_sql() discards the empty ‘join’ clause, and only passes the ‘where’ clause.

Return

(array)

Source

File: bp-core/classes/class-bp-recursive-query.php

	protected function get_sql_clauses() {
		$sql = $this->get_sql_for_query( $this->queries );

		if ( ! empty( $sql['where'] ) ) {
			$sql['where'] = ' AND ' . "\n" . $sql['where'] . "\n";
		}

		return $sql;
	}

Changelog

Changelog
Version Description
BuddyPress 2.2.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.