Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/31/2010 12:05:08 PM (15 years ago)
Author:
apeatling
Message:

Fixes #1701

File:
1 edited

Legend:

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

    r2471 r2488  
    171171    global $groups_template, $bp;
    172172
     173    /***
     174     * Set the defaults based on the current page. Any of these will be overridden
     175     * if arguments are directly passed into the loop. Custom plugins should always
     176     * 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
    173193    $defaults = array(
    174         'type' => 'active',
    175         'page' => 1,
     194        'type' => $type,
     195        'page' => $page,
    176196        'per_page' => 20,
    177197        'max' => false,
    178198
    179         'user_id' => false, // Pass a user ID to limit to groups this user has joined
     199        'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined
    180200        'slug' => false, // Pass a group slug to only return that group
    181201        'search_terms' => false // Pass search terms to return only matching groups
     
    183203
    184204    $r = wp_parse_args( $args, $defaults );
    185     extract( $r, EXTR_SKIP );
     205    extract( $r );
    186206
    187207    if ( '' == $args ) {
Note: See TracChangeset for help on using the changeset viewer.