Changeset 8057
- Timestamp:
- 03/06/2014 02:32:19 AM (11 years ago)
- Location:
- trunk/bp-groups
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r8056 r8057 2316 2316 2317 2317 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND m.is_confirmed = 0 AND m.inviter_id != 0 AND m.invite_sent = 1 AND m.user_id = %d {$exclude_sql} ORDER BY m.date_modified ASC {$pag_sql}", $user_id ) ); 2318 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND m.is_confirmed = 0 AND m.inviter_id != 0 AND m.invite_sent = 1 AND m.user_id = %d {$exclude_sql} ORDER BY date_modified ASC", $user_id ) ); 2319 2320 return array( 'groups' => $paged_groups, 'total' => $total_groups ); 2318 2319 return array( 'groups' => $paged_groups, 'total' => self::get_invite_count_for_user( $user_id ) ); 2320 } 2321 2322 /** 2323 * Gets the total group invite count for a user. 2324 * 2325 * @since BuddyPress (2.0.0) 2326 * 2327 * @param int $user_id The user ID 2328 * @return int 2329 */ 2330 public static function get_invite_count_for_user( $user_id = 0 ) { 2331 global $wpdb; 2332 2333 return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND m.is_confirmed = 0 AND m.inviter_id != 0 AND m.invite_sent = 1 AND m.user_id = %d {$exclude_sql} ORDER BY date_modified ASC", $user_id ) ); 2321 2334 } 2322 2335 -
trunk/bp-groups/bp-groups-functions.php
r8056 r8057 664 664 } 665 665 666 /** 667 * Gets the total group invite count for a user. 668 * 669 * @since BuddyPress (2.0.0) 670 * 671 * @param int $user_id The user ID 672 * @return int 673 */ 674 function groups_get_invite_count_for_user( $user_id = 0 ) { 675 if ( empty( $user_id ) ) { 676 $user_id = bp_loggedin_user_id(); 677 } 678 679 return BP_Groups_Member::get_invite_count_for_user( $user_id ); 680 } 681 666 682 function groups_invite_user( $args = '' ) { 667 683 -
trunk/bp-groups/bp-groups-loader.php
r8056 r8057 537 537 538 538 // Pending group invites 539 $count = groups_get_invite s_for_user( bp_loggedin_user_id());539 $count = groups_get_invite_count_for_user(); 540 540 $title = __( 'Groups', 'buddypress' ); 541 541 $pending = __( 'No Pending Invites', 'buddypress' ); 542 542 543 543 if ( !empty( $count['total'] ) ) { 544 $title = sprintf( __( 'Groups <span class="count">%s</span>', 'buddypress' ), $count ['total']);545 $pending = sprintf( __( 'Pending Invites <span class="count">%s</span>', 'buddypress' ), $count ['total']);544 $title = sprintf( __( 'Groups <span class="count">%s</span>', 'buddypress' ), $count ); 545 $pending = sprintf( __( 'Pending Invites <span class="count">%s</span>', 'buddypress' ), $count ); 546 546 } 547 547
Note: See TracChangeset
for help on using the changeset viewer.