BP_Groups_Group::get_meta_query_sql( array $meta_query = array() )
Get the SQL for the ‘meta_query’ param in BP_Activity_Activity::get()
Description
We use WP_Meta_Query to do the heavy lifting of parsing the meta_query array and creating the necessary SQL clauses.
Parameters
- $meta_query
-
(Optional) An array of meta_query filters. See the documentation for WP_Meta_Query for details.
Default value: array()
Return
(array) $sql_array 'join' and 'where' clauses.
Source
File: bp-groups/classes/class-bp-groups-group.php
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | protected static function get_meta_query_sql( $meta_query = array () ) { global $wpdb ; $sql_array = array ( 'join' => '' , 'where' => '' , ); if ( ! empty ( $meta_query ) ) { $groups_meta_query = new WP_Meta_Query( $meta_query ); // WP_Meta_Query expects the table name at // $wpdb->group. $wpdb ->groupmeta = buddypress()->groups->table_name_groupmeta; $meta_sql = $groups_meta_query ->get_sql( 'group' , 'g' , 'id' ); $sql_array [ 'join' ] = $meta_sql [ 'join' ]; $sql_array [ 'where' ] = self::strip_leading_and( $meta_sql [ 'where' ] ); } return $sql_array ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.8.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.