Changeset 3648
- Timestamp:
- 01/03/2011 10:49:11 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
bp-groups.php (modified) (3 diffs)
-
bp-groups/bp-groups-classes.php (modified) (3 diffs)
-
bp-groups/bp-groups-templatetags.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r3633 r3648 48 48 49 49 // The default text for the groups directory search box 50 $bp->default_search_strings[$bp->groups->slug] = __( 'Search Groups...', 'buddypress' ); 50 $bp->default_search_strings[$bp->groups->slug] = __( 'Search Groups...', 'buddypress' ); 51 51 52 52 do_action( 'groups_setup_globals' ); … … 1820 1820 'exclude' => false, // Do not include these specific groups (group_ids) 1821 1821 'search_terms' => false, // Limit to groups that match these search terms 1822 'show_hidden' => false, // Show hidden groups to non-admins 1822 1823 1823 1824 'per_page' => 20, // The number of results to return per page … … 1829 1830 extract( $params, EXTR_SKIP ); 1830 1831 1831 $groups = BP_Groups_Group::get( $type, $per_page, $page, $user_id, $search_terms, $include, $populate_extras, $exclude );1832 $groups = BP_Groups_Group::get( $type, $per_page, $page, $user_id, $search_terms, $include, $populate_extras, $exclude, $show_hidden ); 1832 1833 1833 1834 return apply_filters( 'groups_get_groups', $groups, &$params ); -
trunk/bp-groups/bp-groups-classes.php
r3617 r3648 256 256 } 257 257 258 function get( $type = 'newest', $per_page = null, $page = null, $user_id = false, $search_terms = false, $include = false, $populate_extras = true, $exclude = false ) {258 function get( $type = 'newest', $per_page = null, $page = null, $user_id = false, $search_terms = false, $include = false, $populate_extras = true, $exclude = false, $show_hidden = false ) { 259 259 global $wpdb, $bp; 260 260 … … 274 274 $sql['where'] = " g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count'"; 275 275 276 if ( ! is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ))276 if ( !$show_hidden ) 277 277 $sql['hidden'] = " AND g.status != 'hidden'"; 278 278 … … 1154 1154 if ( $bp->current_component == $bp->groups->slug && 'admin' == $bp->current_action && !empty( $bp->action_variables[0] ) && $this->slug == $bp->action_variables[0] ) { 1155 1155 // Check whether the user is saving changes 1156 $this->edit_screen_save(); 1157 1156 $this->edit_screen_save(); 1157 1158 1158 add_action( 'groups_custom_edit_steps', array( &$this, 'edit_screen' ) ); 1159 1159 -
trunk/bp-groups/bp-groups-templatetags.php
r3635 r3648 23 23 var $order; 24 24 25 function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras, $exclude ) {25 function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras, $exclude, $show_hidden ) { 26 26 global $bp; 27 27 28 28 $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page; 29 29 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 30 31 if ( $bp->loggedin_user->is_super_admin || ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) ) 32 $show_hidden = true; 30 33 31 34 if ( 'invites' == $type ) { … … 36 39 $this->groups = array( $group ); 37 40 } else { 38 $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'include' => $include, 'exclude' => $exclude, 'populate_extras' => $populate_extras ) );41 $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'include' => $include, 'exclude' => $exclude, 'populate_extras' => $populate_extras, 'show_hidden' => $show_hidden ) ); 39 42 } 40 43 … … 137 140 * pass their parameters directly to the loop. 138 141 */ 142 $slug = false; 139 143 $type = 'active'; 140 $user_id = false; 141 $search_terms = null; 142 $slug = false; 144 $user_id = 0; 143 145 144 146 /* User filtering */ … … 165 167 'per_page' => 20, 166 168 'max' => false, 169 'show_hidden' => false, 167 170 168 171 'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined 169 172 'slug' => $slug, // Pass a group slug to only return that group 170 'search_terms' => $search_terms, // Pass search terms to return only matching groups173 'search_terms' => '', // Pass search terms to return only matching groups 171 174 'include' => false, // Pass comma separated list of group ID's to return only these groups 172 175 'exclude' => false, // Pass comma separated list of group ID's to exclude these groups … … 187 190 } 188 191 189 $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, $include, (bool)$populate_extras, $exclude );192 $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, $include, (bool)$populate_extras, $exclude, $show_hidden ); 190 193 return apply_filters( 'bp_has_groups', $groups_template->has_groups(), $groups_template ); 191 194 } … … 1872 1875 global $bp; 1873 1876 1874 $default_search_value = bp_get_search_default_text(); 1875 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 1877 $default_search_value = bp_get_search_default_text(); 1878 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 1876 1879 1877 1880 ?>
Note: See TracChangeset
for help on using the changeset viewer.