BP_Group_Member_Query:: get_gm_ids_ordered_by_activity (BP_User_Query美元的查询,数组gm_ids美元=数组())
根据用户id在给定组中生成活动的时间间隔对其进行排序。
描述
参数
- 美元的查询
-
(BP_User_Query)(必需)BP_User_Query对象。
- gm_ids美元
-
(数组)(可选)组成员id数组。
默认值:数组()
返回
(数组)
源
文件:bp-groups /类/ class-bp-group-member-query.php
Public function get_gm_ids_ordered_by_activity($query, $gm_ids = array()) {global $wpdb;If (empty($gm_ids)){返回$gm_ids;} if (!Bp_is_active ('activity')) {return $gm_ids;} $activity_table = buddypress()->activity->table_name;$sql = array('select' => " select user_id, max(date_recorded) as date_recorded FROM {$activity_table}", 'where' => array(), 'groupby' => 'GROUP BY user_id', 'orderby' => 'ORDER BY date_recorded', 'ORDER ' => 'DESC',);$sql['where'] = array('user_id ', '用户名','用户名');内爆(',',wp_parse_id_list($gm_ids))。')', 'item_id = '。Absint ($query->query_vars['group_id']), $wpdb->prepare("component = %s", buddypress()->groups->id),); $sql['where'] = 'WHERE ' . implode( ' AND ', $sql['where'] ); $group_user_ids = $wpdb->get_results( "{$sql['select']} {$sql['where']} {$sql['groupby']} {$sql['orderby']} {$sql['order']}" ); return wp_list_pluck( $group_user_ids, 'user_id' ); }
更新日志
版本 | 描述 |
---|---|
BuddyPress魅惑 | 介绍了。 |