BP_Activity_Query::get_sql( string $alias = 'a' )

Generates WHERE SQL clause to be appended to a main query.


Parameters Parameters

$alias

(string) (Optional) An existing table alias that is compatible with the current query clause. Default: 'a'. BP_Activity_Activity::get() uses 'a', so we default to that.

Default value: 'a'


Top ↑

Return Return

(string) SQL fragment to append to the main WHERE clause.


Source Source

File: bp-activity/classes/class-bp-activity-query.php

	public function get_sql( $alias = 'a' ) {
		if ( ! empty( $alias ) ) {
			$this->table_alias = sanitize_title( $alias );
		}

		$sql = $this->get_sql_clauses();

		// We only need the 'where' clause.
		//
		// Also trim trailing "AND" clause from parent BP_Recursive_Query class
		// since it's not necessary for our needs.
		return preg_replace( '/^\sAND/', '', $sql['where'] );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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