Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2010 12:33:13 PM (15 years ago)
Author:
apeatling
Message:

Fixes #1840

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-templatetags.php

    r2580 r2622  
    2323    var $order;
    2424
    25     function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms ) {
     25    function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras ) {
    2626        global $bp;
    2727
     
    3131        switch ( $type ) {
    3232            case 'active': default:
    33                 $this->groups = groups_get_active( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     33                $this->groups = groups_get_active( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    3434                break;
    3535
    3636            case 'alphabetical': default:
    37                 $this->groups = groups_get_alphabetically( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     37                $this->groups = groups_get_alphabetically( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    3838                break;
    3939
    4040            case 'random':
    41                 $this->groups = groups_get_random_groups( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     41                $this->groups = groups_get_random_groups( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    4242                break;
    4343
    4444            case 'newest':
    45                 $this->groups = groups_get_newest( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     45                $this->groups = groups_get_newest( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    4646                break;
    4747
    4848            case 'popular':
    49                 $this->groups = groups_get_popular( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     49                $this->groups = groups_get_popular( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    5050                break;
    5151
    5252            case 'most-forum-topics':
    53                 $this->groups = groups_get_by_most_forum_topics( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     53                $this->groups = groups_get_by_most_forum_topics( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    5454                break;
    5555
    5656            case 'most-forum-posts':
    57                 $this->groups = groups_get_by_most_forum_posts( $this->pag_num, $this->pag_page, $user_id, $search_terms );
     57                $this->groups = groups_get_by_most_forum_posts( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    5858                break;
     59
     60            case 'invites':
     61                $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page );
     62                break;
     63
     64            case 'single-group':
     65                $group = new stdClass;
     66                $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
     67                $this->groups = array( $group );
     68                break;
     69
    5970
    6071            case 'admin-of':
     
    6677                if ( $user_id )
    6778                    $this->groups = groups_get_user_is_mod_of( $user_id, $this->pag_num, $this->pag_page, $filter );
    68                 break;
    69 
    70             case 'invites':
    71                 $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page );
    72                 break;
    73 
    74             case 'single-group':
    75                 $group = new stdClass;
    76                 $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
    77                 $this->groups = array( $group );
    7879                break;
    7980        }
     
    215216        'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined
    216217        'slug' => $slug, // Pass a group slug to only return that group
    217         'search_terms' => $search_terms // Pass search terms to return only matching groups
     218        'search_terms' => $search_terms, // Pass search terms to return only matching groups
     219
     220        'populate_extras' => true // Get extra meta - is_member, is_banned
    218221    );
    219222
     
    221224    extract( $r );
    222225
    223     $groups_template = new BP_Groups_Template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms );
     226    $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, (int)$populate_extras );
    224227    return apply_filters( 'bp_has_groups', $groups_template->has_groups(), &$groups_template );
    225228}
     
    11351138        return false;
    11361139
     1140    if ( 'hidden' == $group->status && !$group->is_member )
     1141        return false;
     1142
    11371143    echo '<div class="generic-button group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">';
    11381144
     
    11541160                    echo '<a class="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';
    11551161            }
     1162        break;
     1163
     1164        case 'hidden':
     1165            if ( $group->is_member )
     1166                echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    11561167        break;
    11571168    }
Note: See TracChangeset for help on using the changeset viewer.