Changeset 2622 for trunk/bp-groups/bp-groups-templatetags.php
- Timestamp:
- 02/08/2010 12:33:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-templatetags.php
r2580 r2622 23 23 var $order; 24 24 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 ) { 26 26 global $bp; 27 27 … … 31 31 switch ( $type ) { 32 32 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 ); 34 34 break; 35 35 36 36 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 ); 38 38 break; 39 39 40 40 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 ); 42 42 break; 43 43 44 44 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 ); 46 46 break; 47 47 48 48 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 ); 50 50 break; 51 51 52 52 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 ); 54 54 break; 55 55 56 56 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 ); 58 58 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 59 70 60 71 case 'admin-of': … … 66 77 if ( $user_id ) 67 78 $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 );78 79 break; 79 80 } … … 215 216 'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined 216 217 '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 218 221 ); 219 222 … … 221 224 extract( $r ); 222 225 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 ); 224 227 return apply_filters( 'bp_has_groups', $groups_template->has_groups(), &$groups_template ); 225 228 } … … 1135 1138 return false; 1136 1139 1140 if ( 'hidden' == $group->status && !$group->is_member ) 1141 return false; 1142 1137 1143 echo '<div class="generic-button group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">'; 1138 1144 … … 1154 1160 echo '<a class="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>'; 1155 1161 } 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>'; 1156 1167 break; 1157 1168 }
Note: See TracChangeset
for help on using the changeset viewer.