Ticket #1793: move_theme_cookies.diff
| File move_theme_cookies.diff, 23.6 KB (added by , 16 years ago) |
|---|
-
bp-themes/bp-default/groups/groups-loop.php
2 2 3 3 <?php do_action( 'bp_before_groups_loop' ) ?> 4 4 5 <?php if ( bp_has_groups( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_groups( bp_dtheme_ajax_querystring( 'groups' ) ) ) : ?> 6 6 7 7 <div class="pagination"> 8 8 -
bp-themes/bp-default/members/members-loop.php
2 2 3 3 <?php do_action( 'bp_before_members_loop' ) ?> 4 4 5 <?php if ( bp_has_members( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_members( bp_dtheme_ajax_querystring( 'members' ) ) ) : ?> 6 6 7 7 <div class="pagination"> 8 8 -
bp-themes/bp-default/activity/activity-loop.php
2 2 3 3 <?php do_action( 'bp_before_activity_loop' ) ?> 4 4 5 <?php if ( bp_has_activities( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_activities( bp_dtheme_ajax_querystring( 'activity' ) ) ) : ?> 6 6 7 7 <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> 8 8 <noscript> -
bp-themes/bp-default/blogs/blogs-loop.php
2 2 3 3 <?php do_action( 'bp_before_blogs_loop' ) ?> 4 4 5 <?php if ( bp_has_blogs( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_blogs( bp_dtheme_ajax_querystring( 'blogs' ) ) ) : ?> 6 6 7 7 <div class="pagination"> 8 8 -
bp-themes/bp-default/_inc/ajax.php
9 9 * your own _inc/ajax.php file and add/remove AJAX functionality as you see fit. 10 10 */ 11 11 12 function bp_dtheme_ajax_querystring( $object = null ) { 13 global $bp; 14 15 /* Backwards and forwards compatibility */ 16 if ( empty( $object ) ) { 17 // no object? just return it 18 return apply_filters( 'bp_dtheme_ajax_querystring', bp_ajax_querystring() ); 19 } 20 21 /* Handle content filtering for the THEME */ 22 $c_scope = 'bp-' . $object . '-scope'; 23 $c_filter = 'bp-' . $object . '-filter'; 24 25 $scope = ( !empty( $_COOKIE[$c_scope] ) ) ? $_COOKIE[$c_scope] : null; 26 $filter = ( !empty( $_COOKIE[$c_filter] ) && '-1' != $_COOKIE[$c_filter] ) ? $_COOKIE[$c_filter] : null; 27 28 $defaults = array( 29 'object' => $object, 30 'scope' => $scope, 31 'type' => $filter 32 ); 33 34 // Do pre-filtering 35 $r = wp_parse_args( bp_ajax_querystring(), $defaults ); 36 $pre_filtered_querystring = apply_filters( 'bp_dtheme_ajax_querystring_' . $object . '_filter', http_build_query($r) ); 37 38 // Return after global filter applied 39 return apply_filters( 'bp_dtheme_ajax_querystring', $pre_filtered_querystring ); 40 } 41 42 /* Personal filtering */ 43 function bp_dtheme_ajax_querystring_filter_personal( $query_string ) { 44 global $bp; 45 46 $r = wp_parse_args( $query_string ); 47 extract($r); 48 49 if ( !empty( $bp->displayed_user->id ) || 'personal' == $scope ) { 50 $r['user_id'] = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 51 return http_build_query($r); 52 } else { 53 return $query_string; 54 } 55 } 56 add_filter( 'bp_dtheme_ajax_querystring_groups_filter', 'bp_dtheme_ajax_querystring_filter_personal', 1 ); 57 add_filter( 'bp_dtheme_ajax_querystring_forums_filter', 'bp_dtheme_ajax_querystring_filter_personal', 1 ); 58 add_filter( 'bp_dtheme_ajax_querystring_members_filter', 'bp_dtheme_ajax_querystring_filter_personal', 1 ); 59 add_filter( 'bp_dtheme_ajax_querystring_blogs_filter', 'bp_dtheme_ajax_querystring_filter_personal', 1 ); 60 61 /* Activity filtering */ 62 function bp_dtheme_ajax_querystring_activity_filter_scope( $query_string ) { 63 global $bp; 64 65 $r = wp_parse_args( $query_string ); 66 extract($r); 67 68 /* User filtering */ 69 if ( !empty( $bp->displayed_user->id ) ) 70 $user_id = $bp->displayed_user->id; 71 72 /* Action filtering */ 73 if ( !empty( $filter ) && '-1' != $filter ) 74 $r['action'] = $filter; 75 76 /* User activity scope filtering */ 77 if ( !empty( $user_id ) || !empty( $scope ) ) { 78 79 $current_user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 80 81 if ( empty( $scope ) || 'just-me' == $scope ) 82 $r['display_comments'] = 'stream'; 83 84 switch ( $scope ) { 85 case BP_FRIENDS_SLUG: 86 if ( function_exists( 'friends_get_friend_user_ids' ) ) 87 $r['user_id'] = implode( ',', (array)friends_get_friend_user_ids( $current_user_id ) ); 88 break; 89 case BP_GROUPS_SLUG: 90 if ( function_exists( 'groups_get_user_groups' ) ) { 91 $groups = groups_get_user_groups( $current_user_id ); 92 $r['object'] = $bp->groups->id; 93 $r['primary_id'] = implode( ',', (array)$groups['groups'] ); 94 $r['show_hidden'] = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0; 95 $r['user_id'] = false; 96 } 97 break; 98 case 'favorites': 99 $favs = bp_activity_get_user_favorites( $current_user_id ); 100 $r['include'] = implode( ',', (array)$favs ); 101 $r['show_hidden'] = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0; 102 break; 103 case 'mentions': 104 $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename; 105 $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login; 106 $r['search_terms'] = '@' . bp_core_get_username( $current_user_id, $user_nicename, $user_login ); 107 $r['show_hidden'] = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0; 108 $r['display_comments'] = 'stream'; 109 $r['user_id'] = false; 110 break; 111 } 112 } 113 114 /* Group filtering */ 115 if ( !empty( $bp->groups->current_group ) ) { 116 117 $r['object'] = $bp->groups->id; 118 $r['primary_id'] = $bp->groups->current_group->id; 119 120 /* If we're viewing a non-private group and the user is a member, show the hidden activity for the group */ 121 if ( 'public' != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) 122 $r['show_hidden'] = 1; 123 } 124 125 /* Support for permalinks on single item pages: /groups/my-group/activity/124/ */ 126 if ( $bp->current_action == $bp->activity->slug ) 127 $r['include'] = $bp->action_variables[0]; 128 129 return http_build_query($r); 130 } 131 add_filter( 'bp_dtheme_ajax_querystring_activity_filter', 'bp_dtheme_ajax_querystring_activity_filter_scope', 1 ); 132 12 133 function bp_dtheme_object_filter() { 13 134 global $bp; 14 135 … … 30 151 $search_terms = false; 31 152 32 153 /* Build the querystring */ 33 if ( empty( $filter ) ) 34 $filter = 'active'; 154 $querystring_args = 155 array( 156 'object' => $object, 157 'scope' => $scope, 158 'filter' => empty( $filter ) ? 'active' : $filter, 159 'page' => empty( $page ) ? 1 : $page 160 ); 35 161 36 $bp->ajax_querystring = 'type=' . $filter . '&page=' . $page;37 38 162 if ( !empty( $search_terms ) ) 39 $ bp->ajax_querystring .= '&search_terms=' .$search_terms;163 $querystring_args['search_terms'] = $search_terms; 40 164 41 if ( $scope == 'personal' || $bp->displayed_user->id ) { 42 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 43 $bp->ajax_querystring .= '&user_id=' . $user_id; 44 } 165 bp_set_ajax_querystring( apply_filters( 'bp_dtheme_ajax_querystring_content_filter', http_build_query($querystring_args), $extras ) ); 45 166 46 $bp->ajax_querystring = apply_filters( 'bp_dtheme_ajax_querystring_content_filter', $bp->ajax_querystring, $extras );47 48 167 locate_template( array( "$object/$object-loop.php" ), true ); 49 168 } 50 169 add_action( 'wp_ajax_members_filter', 'bp_dtheme_object_filter' ); … … 180 299 function bp_dtheme_activity_loop( $scope = false, $filter = false, $per_page = 20, $page = 1 ) { 181 300 global $bp; 182 301 183 /* If we are on a profile page we only want to show that users activity */ 184 if ( $bp->displayed_user->id ) { 185 $query_string = 'user_id=' . $bp->displayed_user->id; 186 } else { 302 /* Build the querystring */ 303 $querystring_args = 304 array( 305 'object' => 'activity', 306 'scope' => $scope, 307 'filter' => $filter, 308 'per_page' => $per_page, 309 'page' => $page, 310 ); 311 312 /* If we are NOT on a profile page we need to determine the feed url */ 313 if ( !$bp->displayed_user->id ) { 314 187 315 if ( !empty( $bp->groups->current_group ) ) 188 316 $scope = 'all'; 189 317 … … 191 319 192 320 switch ( $scope ) { 193 321 case BP_FRIENDS_SLUG: 194 $friend_ids = implode( ',', friends_get_friend_user_ids( $bp->loggedin_user->id ) );195 $query_string = 'user_id=' . $friend_ids;196 322 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/' . BP_FRIENDS_SLUG . '/feed/'; 197 323 break; 198 324 case BP_GROUPS_SLUG: 199 $groups = groups_get_user_groups( $bp->loggedin_user->id );200 $group_ids = implode( ',', $groups['groups'] );201 $query_string = 'object=groups&primary_id=' . $group_ids . '&show_hidden=1';202 325 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/feed/'; 203 326 break; 204 327 case 'favorites': 205 $favs = bp_activity_get_user_favorites( $bp->loggedin_user->id );206 207 if ( empty( $favs ) )208 $favorite_ids = false;209 210 $favorite_ids = implode( ',', (array)$favs );211 $query_string = 'include=' . $favorite_ids;212 328 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/favorites/feed/'; 213 329 break; 214 330 case 'mentions': 215 $query_string = 'show_hidden=1&search_terms=@' . bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login );216 331 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/mentions/feed/'; 217 218 332 /* Reset the number of new @ mentions for the user */ 219 333 delete_usermeta( $bp->loggedin_user->id, 'bp_new_mention_count' ); 220 334 break; 221 335 } 222 336 } 223 337 224 /* Build the filter */ 225 if ( $filter && $filter != '-1' ) 226 $query_string .= '&action=' . $filter; 227 228 /* If we are viewing a group then filter the activity just for this group */ 229 if ( !empty( $bp->groups->current_group ) ) { 230 $query_string .= '&object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id; 231 232 /* If we're viewing a non-private group and the user is a member, show the hidden activity for the group */ 233 if ( 'public' != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) 234 $query_string .= '&show_hidden=1'; 235 } 236 237 /* Add the per_page param */ 238 $query_string .= '&per_page=' . $per_page; 239 240 /* Add the comments param */ 241 if ( $bp->displayed_user->id || 'mentions' == $scope ) 242 $query_string .= '&display_comments=stream'; 243 else 244 $query_string .= '&display_comments=threaded'; 245 246 /* Add the new page param */ 247 $args = explode( '&', trim( $query_string ) ); 248 foreach( (array)$args as $arg ) { 249 if ( false === strpos( $arg, 'page' ) ) 250 $new_args[] = $arg; 251 } 252 $query_string = implode( '&', $new_args ) . '&page=' . $page; 253 254 $bp->ajax_querystring = apply_filters( 'bp_dtheme_ajax_querystring_activity_filter', $query_string, $scope ); 255 $result['query_string'] = $bp->ajax_querystring; 338 bp_set_ajax_querystring( apply_filters( 'bp_dtheme_ajax_querystring_activity_filter', http_build_query($querystring_args), $scope ) ); 339 $result['query_string'] = bp_ajax_querystring(); 256 340 $result['feed_url'] = apply_filters( 'bp_dtheme_ajax_feed_url', $feed_url ); 257 341 258 342 /* Buffer the loop in the template to a var for JS to spit out. */ -
bp-themes/bp-default/forums/forums-loop.php
1 <?php if ( bp_has_forum_topics( bp_ ajax_querystring() ) ) : ?>1 <?php if ( bp_has_forum_topics( bp_dtheme_ajax_querystring( 'forums' ) ) ) : ?> 2 2 3 3 <div class="pagination"> 4 4 -
bp-core/bp-core-templatetags.php
117 117 function bp_has_members( $args = '' ) { 118 118 global $bp, $members_template; 119 119 120 /***121 * Set the defaults based on the current page. Any of these will be overridden122 * if arguments are directly passed into the loop. Custom plugins should always123 * pass their parameters directly to the loop.124 */125 $type = 'active';126 $user_id = false;127 $page = 1;128 129 /* User filtering */130 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-members-scope'] )131 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;132 133 /* Action filtering */134 if ( !empty( $_COOKIE['bp-members-filter'] ) && '-1' != $_COOKIE['bp-members-filter'] )135 $type = $_COOKIE['bp-members-filter'];136 137 if ( !empty( $_COOKIE['bp-members-page'] ) && '-1' != $_COOKIE['bp-members-page'] )138 $page = $_COOKIE['bp-members-page'];139 140 120 // type: active ( default ) | random | newest | popular | online | alphabetical 141 121 $defaults = array( 142 'type' => $type,143 'page' => $page,122 'type' => 'active', 123 'page' => 1, 144 124 'per_page' => 20, 145 125 'max' => false, 146 126 147 127 'include' => false, // Pass a user_id or comma separated list of user_ids to only show these users 148 128 149 'user_id' => $user_id, // Pass a user_id to only show friends of this user129 'user_id' => false, // Pass a user_id to only show friends of this user 150 130 'search_terms' => false, // Pass search_terms to filter users by their profile data 151 131 152 132 'populate_extras' => true // Fetch usermeta? Friend count, last active etc. … … 1399 1379 return apply_filters( 'bp_ajax_querystring', $bp->ajax_querystring ); 1400 1380 } 1401 1381 1382 function bp_set_ajax_querystring( $string ) { 1383 global $bp; 1384 1385 $bp->ajax_querystring = apply_filters( 'bp_set_ajax_querystring', $string ); 1386 } 1387 1402 1388 /* Template is_() functions to determine the current page */ 1403 1389 1404 1390 function bp_is_active( $component ) { -
bp-activity/bp-activity-templatetags.php
116 116 function bp_has_activities( $args = '' ) { 117 117 global $bp, $activities_template; 118 118 119 /***120 * Set the defaults based on the current page. Any of these will be overridden121 * if arguments are directly passed into the loop. Custom plugins should always122 * pass their parameters directly to the loop.123 */124 $user_id = false;125 $include = false;126 $show_hidden = false;127 $search_terms = false;128 $object = false;129 $action = false;130 $primary_id = false;131 $display_comments = 'threaded';132 133 /* User filtering */134 if ( !empty( $bp->displayed_user->id ) )135 $user_id = $bp->displayed_user->id;136 137 /* Action filtering */138 if ( !empty( $_COOKIE['bp-activity-filter'] ) && '-1' != $_COOKIE['bp-activity-filter'] )139 $action = $_COOKIE['bp-activity-filter'];140 141 /* User activity scope filtering */142 if ( !empty( $user_id ) || !empty( $_COOKIE['bp-activity-scope'] ) ) {143 $scope = ( !empty( $bp->current_action ) ) ? $bp->current_action : $_COOKIE['bp-activity-scope'];144 $current_user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;145 146 if ( empty( $scope ) || 'just-me' == $scope )147 $display_comments = 'stream';148 149 switch ( $scope ) {150 case 'friends':151 if ( function_exists( 'friends_get_friend_user_ids' ) )152 $user_id = implode( ',', (array)friends_get_friend_user_ids( $current_user_id ) );153 break;154 case 'groups':155 if ( function_exists( 'groups_get_user_groups' ) ) {156 $groups = groups_get_user_groups( $current_user_id );157 $object = $bp->groups->id;158 $primary_id = implode( ',', (array)$groups['groups'] );159 $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;160 $user_id = false;161 }162 break;163 case 'favorites':164 $favs = bp_activity_get_user_favorites( $current_user_id );165 $include = implode( ',', (array)$favs );166 $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;167 break;168 case 'mentions':169 $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;170 $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;171 $search_terms = '@' . bp_core_get_username( $current_user_id, $user_nicename, $user_login );172 $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;173 $display_comments = 'stream';174 $user_id = false;175 break;176 }177 }178 179 /* Group filtering */180 if ( !empty( $bp->groups->current_group ) ) {181 $object = $bp->groups->id;182 $primary_id = $bp->groups->current_group->id;183 184 if ( 'public' != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )185 $show_hidden = true;186 }187 188 /* Support for permalinks on single item pages: /groups/my-group/activity/124/ */189 if ( $bp->current_action == $bp->activity->slug )190 $include = $bp->action_variables[0];191 192 119 /* Note: any params used for filtering can be a single value, or multiple values comma separated. */ 193 120 $defaults = array( 194 'display_comments' => $display_comments, // false for none, stream/threaded - show comments in the stream or threaded under items195 'include' => $include, // pass an activity_id or string of ID's comma separated121 'display_comments' => 'threaded', // false for none, stream/threaded - show comments in the stream or threaded under items 122 'include' => false, // pass an activity_id or string of ID's comma separated 196 123 'sort' => 'DESC', // sort DESC or ASC 197 124 'page' => 1, // which page to load 198 125 'per_page' => 25, // number of items per page 199 126 'max' => false, // max number to return 200 'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?127 'show_hidden' => false, // Show activity items that are hidden site-wide? 201 128 202 129 /* Filtering */ 203 'user_id' => $user_id, // user_id to filter on204 'object' => $object, // object to filter on e.g. groups, profile, status, friends205 'action' => $action, // action to filter on e.g. activity_update, new_forum_post, profile_updated206 'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.130 'user_id' => false, // user_id to filter on 131 'object' => false, // object to filter on e.g. groups, profile, status, friends 132 'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated 133 'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc. 207 134 'secondary_id' => false, // secondary object ID to filter on e.g. a post_id 208 135 209 136 /* Searching */ 210 'search_terms' => $search_terms// specify terms to search on137 'search_terms' => false // specify terms to search on 211 138 ); 212 139 213 140 $r = wp_parse_args( $args, $defaults ); -
bp-blogs/bp-blogs-templatetags.php
109 109 function bp_has_blogs( $args = '' ) { 110 110 global $bp, $blogs_template; 111 111 112 /***113 * Set the defaults based on the current page. Any of these will be overridden114 * if arguments are directly passed into the loop. Custom plugins should always115 * pass their parameters directly to the loop.116 */117 $type = 'active';118 $user_id = false;119 $page = 1;120 121 /* User filtering */122 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-blogs-scope'] )123 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;124 125 /* Action filtering */126 if ( !empty( $_COOKIE['bp-blogs-filter'] ) && '-1' != $_COOKIE['bp-blogs-filter'] )127 $type = $_COOKIE['bp-blogs-filter'];128 129 if ( !empty( $_COOKIE['bp-blogs-page'] ) && '-1' != $_COOKIE['bp-blogs-page'] )130 $page = $_COOKIE['bp-blogs-page'];131 132 112 $defaults = array( 133 'type' => $type,134 'page' => $page,113 'type' => 'active', 114 'page' => 1, 135 115 'per_page' => 20, 136 116 'max' => false, 137 117 138 'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to118 'user_id' => false, // Pass a user_id to limit to only blogs this user has higher than subscriber access to 139 119 'search_terms' => false // Pass search terms to filter on the blog title or description. 140 120 ); 141 121 -
bp-forums/bp-forums-templatetags.php
155 155 function bp_has_forum_topics( $args = '' ) { 156 156 global $forum_template, $bp; 157 157 158 /***159 * Set the defaults based on the current page. Any of these will be overridden160 * if arguments are directly passed into the loop. Custom plugins should always161 * pass their parameters directly to the loop.162 */163 $type = 'newest';164 $user_id = false;165 $page = 1;166 167 /* User filtering */168 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-forums-scope'] )169 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;170 171 /* Action filtering */172 if ( !empty( $_COOKIE['bp-forums-filter'] ) && '-1' != $_COOKIE['bp-forums-filter'] )173 $type = $_COOKIE['bp-forums-filter'];174 175 if ( !empty( $_COOKIE['bp-forums-page'] ) && '-1' != $_COOKIE['bp-forums-page'] )176 $page = $_COOKIE['bp-forums-page'];177 178 158 $defaults = array( 179 'type' => $type,159 'type' => 'newest', 180 160 'forum_id' => false, 181 'user_id' => $user_id,182 'page' => $page,161 'user_id' => false, 162 'page' => 1, 183 163 'per_page' => 20, 184 164 'max' => false, 185 165 'no_stickies' => false, -
bp-groups/bp-groups-templatetags.php
170 170 function bp_has_groups( $args = '' ) { 171 171 global $groups_template, $bp; 172 172 173 /***174 * Set the defaults based on the current page. Any of these will be overridden175 * if arguments are directly passed into the loop. Custom plugins should always176 * pass their parameters directly to the loop.177 */178 $type = 'active';179 $user_id = false;180 $page = 1;181 182 /* User filtering */183 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-groups-scope'] )184 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;185 186 /* Action filtering */187 if ( !empty( $_COOKIE['bp-groups-filter'] ) && '-1' != $_COOKIE['bp-groups-filter'] )188 $type = $_COOKIE['bp-groups-filter'];189 190 if ( !empty( $_COOKIE['bp-groups-page'] ) && '-1' != $_COOKIE['bp-groups-page'] )191 $page = $_COOKIE['bp-groups-page'];192 193 173 $defaults = array( 194 'type' => $type,195 'page' => $page,174 'type' => 'active', 175 'page' => 1, 196 176 'per_page' => 20, 197 177 'max' => false, 198 178 199 'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined179 'user_id' => false, // Pass a user ID to limit to groups this user has joined 200 180 'slug' => false, // Pass a group slug to only return that group 201 181 'search_terms' => false // Pass search terms to return only matching groups 202 182 );