Skip to:
Content

BuddyPress.org

Changeset 2858


Ignore:
Timestamp:
03/19/2010 10:14:45 AM (15 years ago)
Author:
apeatling
Message:

Refresh the group member count meta when visiting the group members tab. Fixes #2211

Location:
branches/1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-groups.php

    r2833 r2858  
    565565
    566566    if ( $bp->is_single_item ) {
     567        /* Refresh the group member count meta */
     568        groups_update_groupmeta( $bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count( $bp->groups->current_group->id ) );
     569
    567570        do_action( 'groups_screen_group_members', $bp->groups->current_group->id );
    568571        bp_core_load_template( apply_filters( 'groups_template_group_members', 'groups/single/home' ) );
     
    17231726}
    17241727
     1728function groups_get_total_member_count( $group_id ) {
     1729    return BP_Groups_Group::get_total_member_count( $group_id );
     1730}
     1731
    17251732/*** Group Fetching, Filtering & Searching  *************************************/
    17261733
  • branches/1.2/bp-groups/bp-groups-classes.php

    r2794 r2858  
    613613        return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
    614614    }
     615
     616    function get_total_member_count( $group_id ) {
     617        global $wpdb, $bp;
     618
     619        return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
     620    }
    615621}
    616622
Note: See TracChangeset for help on using the changeset viewer.