diff --git src/bp-groups/classes/class-bp-groups-group.php src/bp-groups/classes/class-bp-groups-group.php
index bde4f1e..6dd1714 100644
|
|
class BP_Groups_Group { |
980 | 980 | |
981 | 981 | // Populate some extra information instead of querying each time in the loop. |
982 | 982 | if ( !empty( $r['populate_extras'] ) ) { |
983 | | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, $r['type'] ); |
| 983 | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, $r['type'], $r['user_id'] ); |
984 | 984 | } |
985 | 985 | |
986 | 986 | // Grab all groupmeta. |
… |
… |
class BP_Groups_Group { |
1155 | 1155 | foreach ( (array) $paged_groups as $group ) { |
1156 | 1156 | $group_ids[] = $group->id; |
1157 | 1157 | } |
1158 | | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); |
| 1158 | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest', $user_id ); |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | return array( 'groups' => $paged_groups, 'total' => $total_groups ); |
… |
… |
class BP_Groups_Group { |
1261 | 1261 | foreach ( (array) $paged_groups as $group ) { |
1262 | 1262 | $group_ids[] = $group->id; |
1263 | 1263 | } |
1264 | | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); |
| 1264 | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest', $user_id ); |
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | return array( 'groups' => $paged_groups, 'total' => $total_groups ); |
… |
… |
class BP_Groups_Group { |
1397 | 1397 | foreach ( (array) $paged_groups as $group ) { |
1398 | 1398 | $group_ids[] = $group->id; |
1399 | 1399 | } |
1400 | | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); |
| 1400 | $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest', $user_id ); |
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | return array( 'groups' => $paged_groups, 'total' => $total_groups ); |
… |
… |
class BP_Groups_Group { |
1419 | 1419 | * @param string|array $group_ids Array or comma-separated list of IDs matching |
1420 | 1420 | * $paged_groups. |
1421 | 1421 | * @param string|bool $type Not used. |
| 1422 | * @param int $user_id Optional. If provided, results will be limited to groups |
| 1423 | * of which the specified user is a member. Default: false. |
1422 | 1424 | * @return array $paged_groups |
1423 | 1425 | */ |
1424 | | public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) { |
1425 | | $user_id = bp_loggedin_user_id(); |
| 1426 | public static function get_group_extras( &$paged_groups, &$group_ids, $type = false, $user_id = false ) { |
| 1427 | $user_id = empty( $user_id ) ? bp_loggedin_user_id() : $user_id; |
1426 | 1428 | |
1427 | 1429 | foreach ( $paged_groups as &$group ) { |
1428 | 1430 | $group->is_member = groups_is_user_member( $user_id, $group->id ) ? '1' : '0'; |