BP_Activity_Query::get_sql( string $alias = 'a' )
Generates WHERE SQL clause to be appended to a main query.
Description
Parameters
- $alias
-
(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'
Return
(string) SQL fragment to append to the main WHERE clause.
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'] ); }
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.