Skip to:
Content

BuddyPress.org

Changeset 2488


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

Fixes #1701

Location:
trunk
Files:
18 edited

Legend:

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

    r2487 r2488  
    127127    $search_terms = false;
    128128    $object = false;
     129    $action = false;
    129130    $primary_id = false;
    130131    $display_comments = 'threaded';
     
    134135        $user_id = $bp->displayed_user->id;
    135136
     137    /* Action filtering */
     138    if ( !empty( $_COOKIE['bp-activity-filter'] ) && '-1' != $_COOKIE['bp-activity-filter'] )
     139        $action = $_COOKIE['bp-activity-filter'];
     140
    136141    /* User activity scope filtering */
    137     if ( !empty( $user_id ) ) {
    138         if ( empty( $bp->current_action ) || 'just-me' ==  $bp->current_action )
     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 )
    139147            $display_comments = 'stream';
    140148
    141         switch ( $bp->current_action ) {
     149        switch ( $scope ) {
    142150            case 'friends':
    143151                if ( function_exists( 'friends_get_friend_user_ids' ) )
    144                     $user_id = implode( ',', (array)friends_get_friend_user_ids( $bp->displayed_user->id ) );
     152                    $user_id = implode( ',', (array)friends_get_friend_user_ids( $current_user_id ) );
    145153                break;
    146154            case 'groups':
    147155                if ( function_exists( 'groups_get_user_groups' ) ) {
    148                     $groups = groups_get_user_groups( $bp->displayed_user->id );
     156                    $groups = groups_get_user_groups( $current_user_id );
    149157                    $object = $bp->groups->id;
    150158                    $primary_id = implode( ',', (array)$groups['groups'] );
    151                     $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
     159                    $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;
    152160                    $user_id = false;
    153161                }
    154162                break;
    155163            case 'favorites':
    156                 $favs = bp_activity_get_user_favorites( $bp->displayed_user->id );
     164                $favs = bp_activity_get_user_favorites( $current_user_id );
    157165                $include = implode( ',', (array)$favs );
    158                 $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
     166                $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;
    159167                break;
    160168            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';
    161174                $user_id = false;
    162                 $search_terms = '@' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login );
    163                 $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
    164                 $display_comments = 'stream';
    165175                break;
    166176        }
     
    190200        'user_id' => $user_id, // user_id to filter on
    191201        'object' => $object, // object to filter on e.g. groups, profile, status, friends
    192         'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated
     202        'action' => $action, // action to filter on e.g. activity_update, new_forum_post, profile_updated
    193203        'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
    194204        'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
  • trunk/bp-blogs/bp-blogs-templatetags.php

    r2389 r2488  
    127127    global $blogs_template;
    128128
     129    /***
     130     * Set the defaults based on the current page. Any of these will be overridden
     131     * if arguments are directly passed into the loop. Custom plugins should always
     132     * pass their parameters directly to the loop.
     133     */
     134    $type = 'active';
     135    $user_id = false;
     136    $page = 1;
     137
     138    /* User filtering */
     139    if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-blogs-scope'] )
     140        $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
     141
     142    /* Action filtering */
     143    if ( !empty( $_COOKIE['bp-blogs-filter'] ) && '-1' != $_COOKIE['bp-blogs-filter'] )
     144        $type = $_COOKIE['bp-blogs-filter'];
     145
     146    if ( !empty( $_COOKIE['bp-blogs-page'] ) && '-1' != $_COOKIE['bp-blogs-page'] )
     147        $page = $_COOKIE['bp-blogs-page'];
     148
    129149    $defaults = array(
    130         'type' => 'active',
    131         'page' => 1,
     150        'type' => $type,
     151        'page' => $page,
    132152        'per_page' => 20,
    133153        'max' => false,
    134154
    135         'user_id' => false, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
     155        'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
    136156        'search_terms' => false // Pass search terms to filter on the blog title or description.
    137157    );
  • trunk/bp-core/bp-core-templatetags.php

    r2485 r2488  
    118118    global $bp, $members_template;
    119119
     120    /***
     121     * Set the defaults based on the current page. Any of these will be overridden
     122     * if arguments are directly passed into the loop. Custom plugins should always
     123     * 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
    120140    // type: active ( default ) | random | newest | popular | online | alphabetical
    121141    $defaults = array(
    122         'type' => 'active',
    123         'page' => 1,
    124         'per_page' => 10,
     142        'type' => $type,
     143        'page' => $page,
     144        'per_page' => 20,
    125145        'max' => false,
    126146
    127147        'include' => false, // Pass a user_id or comma separated list of user_ids to only show these users
    128148
    129         'user_id' => false, // Pass a user_id to only show friends of this user
     149        'user_id' => $user_id, // Pass a user_id to only show friends of this user
    130150        'search_terms' => false, // Pass search_terms to filter users by their profile data
    131151
     
    134154
    135155    $r = wp_parse_args( $args, $defaults );
    136     extract( $r, EXTR_SKIP );
     156    extract( $r );
    137157
    138158    if ( $max ) {
  • trunk/bp-forums/bp-forums-templatetags.php

    r2460 r2488  
    153153    global $forum_template, $bp;
    154154
     155    /***
     156     * Set the defaults based on the current page. Any of these will be overridden
     157     * if arguments are directly passed into the loop. Custom plugins should always
     158     * pass their parameters directly to the loop.
     159     */
     160    $type = 'newest';
     161    $user_id = false;
     162    $page = 1;
     163
     164    /* User filtering */
     165    if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-forums-scope'] )
     166        $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
     167
     168    /* Action filtering */
     169    if ( !empty( $_COOKIE['bp-forums-filter'] ) && '-1' != $_COOKIE['bp-forums-filter'] )
     170        $type = $_COOKIE['bp-forums-filter'];
     171
     172    if ( !empty( $_COOKIE['bp-forums-page'] ) && '-1' != $_COOKIE['bp-forums-page'] )
     173        $page = $_COOKIE['bp-forums-page'];
     174
    155175    $defaults = array(
    156         'type' => 'newest',
     176        'type' => $type,
    157177        'forum_id' => false,
    158         'user_id' => false,
    159         'page' => 1,
    160         'per_page' => 15,
     178        'user_id' => $user_id,
     179        'page' => $page,
     180        'per_page' => 20,
    161181        'max' => false,
    162182        'no_stickies' => false,
     
    165185
    166186    $r = wp_parse_args( $args, $defaults );
    167     extract( $r, EXTR_SKIP );
     187    extract( $r );
    168188
    169189    /* If we're in a single group, set this group's forum_id */
  • 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 ) {
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r2485 r2488  
    201201                    $feed_url = $bp->loggedin_user->domain  . BP_ACTIVITY_SLUG . '/favorites/feed/';
    202202                    break;
    203                 case 'atme':
     203                case 'mentions':
    204204                    $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 );
    205205                    $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/mentions/feed/';
     
    228228
    229229        /* Add the comments param */
    230         if ( $bp->displayed_user->id || 'atme' == $scope )
     230        if ( $bp->displayed_user->id || 'mentions' == $scope )
    231231            $query_string .= '&display_comments=stream';
    232232        else
  • trunk/bp-themes/bp-default/_inc/global.js

    r2485 r2488  
    55    /**** Page Load Actions *******************************************************/
    66
    7     /* Activity */
    8     if ( j('div.activity').length && !j('div.activity').hasClass('no-ajax') ) {
    9         /* If there's a hash URL, try and use it. */
    10         if ( location.hash.length )
    11             var scope = location.hash.substr( 1, location.hash.length - 2 );
    12         else
    13             var scope = j.cookie('bp-activity-scope');
    14 
    15         bp_activity_request( scope, j.cookie('bp-activity-filter') );
     7    /* Activity Filter Select Set */
     8    if ( null != j.cookie('bp-activity-filter') && j('#activity-filter-select').length )
     9        j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
     10
     11    /* Activity Tab Set */
     12    if ( null != j.cookie('bp-activity-scope') && j('div.item-list-tabs').length ) {
     13        j('div.item-list-tabs li').each( function() {
     14            j(this).removeClass('selected');
     15        });
     16        j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
    1617    }
    1718
    18     /* Members */
    19     if ( j('div.members').length )
    20         bp_filter_request( 'members', j.cookie('bp-members-filter'), j.cookie('bp-members-scope'), 'div.members', false, 1, j.cookie('bp-members-extras') );
    21 
    22     /* Groups */
    23     if ( j('div.groups').length )
    24         bp_filter_request( 'groups', j.cookie('bp-groups-filter'), j.cookie('bp-groups-scope'), 'div.groups', false, 1, j.cookie('bp-groups-extras') );
    25 
    26     /* Blogs */
    27     if ( j('div.blogs').length )
    28         bp_filter_request( 'blogs', j.cookie('bp-blogs-filter'), j.cookie('bp-blogs-scope'), 'div.blogs', false, 1, j.cookie('bp-blogs-extras') );
    29 
    30     /* Forums */
    31     if ( j('div.forums').length ) {
     19    /* Hide Forums Post Form */
     20    if ( j('div.forums').length )
    3221        j('div#new-topic-post').hide();
    33         bp_filter_request( 'forums', j.cookie('bp-forums-filter'), j.cookie('bp-forums-scope'), 'div.forums', false, 1, j.cookie('bp-forums-extras') );
    34     }
     22
     23    /* Object filter and scope set. */
     24    var objects = [ 'members', 'groups', 'blogs', 'forums' ];
     25    j(objects).each( function(i) {
     26        if ( null != j.cookie('bp-' + objects[i] + '-filter') && j('div.' + objects[i]).length )
     27            j('li#' + objects[i] + '-order-select select option[value=' + j.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
     28
     29        if ( null != j.cookie('bp-' + objects[i] + '-scope') && j('div.' + objects[i]).length ) {
     30            j('div.item-list-tabs li').each( function() {
     31                j(this).removeClass('selected');
     32            });
     33            j('div.item-list-tabs li#' + objects[i] + '-' + j.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
     34        }
     35    });
    3536
    3637    /* @mention Compose Scrolling */
     
    117118        var filter = j("#activity-filter-select select").val();
    118119
    119         if ( scope == 'atme' )
     120        if ( scope == 'mentions' )
    120121            j( 'li#' + target.attr('id') + ' a strong' ).remove();
    121122
     
    168169                if ( 'fav' == type ) {
    169170                    if ( !j('div.item-list-tabs li#activity-favorites').length )
    170                         j('div.item-list-tabs ul li#activity-atme').before( '<li id="activity-favorites"><a href="#">' + bp_terms_my_favs + ' (<span>0</span>)</a></li>');
     171                        j('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + bp_terms_my_favs + ' (<span>0</span>)</a></li>');
    171172
    172173                    target.removeClass('fav');
     
    972973    });
    973974
    974     /* Clear specificcookies on logout */
     975    /* Clear BP cookies on logout */
    975976    j('a.logout').click( function() {
    976977        j.cookie('bp-activity-scope', null);
    977978        j.cookie('bp-activity-filter', null);
    978979        j.cookie('bp-activity-querystring', null);
     980
     981        var objects = [ 'members', 'groups', 'blogs', 'forums' ];
     982        j(objects).each( function(i) {
     983            j.cookie('bp-' + objects[i] + '-scope', null );
     984            j.cookie('bp-' + objects[i] + '-filter', null );
     985            j.cookie('bp-' + objects[i] + '-search-terms', null );
     986            j.cookie('bp-' + objects[i] + '-page', null );
     987            j.cookie('bp-' + objects[i] + '-extras', null );
     988        });
    979989    });
    980990});
  • trunk/bp-themes/bp-default/activity/index.php

    r2485 r2488  
    3838                        <?php endif; ?>
    3939
    40                         <li id="activity-atme"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>
     40                        <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>
    4141
    4242                    <?php endif; ?>
     
    7272
    7373            <div class="activity">
    74                 <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    75                 <noscript><?php locate_template( array( 'activity/activity-loop.php' ), true ) ?></noscript>
     74                <?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
    7675            </div><!-- .activity -->
    7776
  • trunk/bp-themes/bp-default/blogs/index.php

    r2455 r2488  
    3939
    4040            <div id="blogs-dir-list" class="blogs dir-list">
    41                 <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    42                 <noscript><?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ?></noscript>
     41                <?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ?>
    4342            </div><!-- #blogs-dir-list -->
    4443
  • trunk/bp-themes/bp-default/forums/index.php

    r2455 r2488  
    9393
    9494            <div id="forums-dir-list" class="forums dir-list">
    95                 <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    96                 <noscript><?php locate_template( array( 'forums/forums-loop.php' ), true ) ?></noscript>
     95                <?php locate_template( array( 'forums/forums-loop.php' ), true ) ?>
    9796            </div>
    9897
  • trunk/bp-themes/bp-default/groups/index.php

    r2455 r2488  
    3939
    4040            <div id="groups-dir-list" class="groups dir-list">
    41                 <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    42                 <noscript><?php locate_template( array( 'groups/groups-loop.php' ), true ) ?></noscript>
     41                <?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
    4342            </div><!-- #groups-dir-list -->
    4443
  • trunk/bp-themes/bp-default/groups/single/activity.php

    r2459 r2488  
    2929
    3030<div class="activity single-group">
    31     <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    32     <noscript><?php locate_template( array( 'activity/activity-loop.php' ), true ) ?></noscript>
     31    <?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
    3332</div><!-- .activity -->
    3433
  • trunk/bp-themes/bp-default/groups/single/forum.php

    r2460 r2488  
    1010
    1111    <div class="forums single-forum">
    12         <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    13         <noscript><?php locate_template( array( 'forums/forums-loop.php' ), true ) ?></noscript>
     12        <?php locate_template( array( 'forums/forums-loop.php' ), true ) ?>
    1413    </div><!-- .forums -->
    1514
  • trunk/bp-themes/bp-default/members/index.php

    r2455 r2488  
    3939
    4040            <div id="members-dir-list" class="members dir-list">
    41                 <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    42                 <noscript><?php locate_template( array( 'members/members-loop.php' ), true ) ?></noscript>
     41                <?php locate_template( array( 'members/members-loop.php' ), true ) ?>
    4342            </div><!-- #members-dir-list -->
    4443
  • trunk/bp-themes/bp-default/members/single/activity.php

    r2485 r2488  
    3131
    3232<div class="activity">
    33     <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    34     <noscript><?php locate_template( array( 'activity/activity-loop.php' ), true ) ?></noscript>
     33    <?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
    3534</div><!-- .activity -->
    3635
  • trunk/bp-themes/bp-default/members/single/blogs.php

    r2455 r2488  
    1919
    2020<div class="blogs myblogs">
    21     <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    22     <noscript><?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ?></noscript>
     21    <?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ?>
    2322</div><!-- .blogs -->
    2423
  • trunk/bp-themes/bp-default/members/single/friends.php

    r2455 r2488  
    2727
    2828    <div class="members friends">
    29         <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    30         <noscript><?php locate_template( array( 'members/members-loop.php' ), true ) ?></noscript>
     29        <?php locate_template( array( 'members/members-loop.php' ), true ) ?>
    3130    </div>
    3231
  • trunk/bp-themes/bp-default/members/single/groups.php

    r2455 r2488  
    3030
    3131    <div class="groups mygroups">
    32         <?php // The loop will be loaded here via AJAX on page load to retain selected settings and not waste cycles. ?>
    33         <noscript><?php locate_template( array( 'groups/groups-loop.php' ), true ) ?></noscript>
     32        <?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
    3433    </div>
    3534
Note: See TracChangeset for help on using the changeset viewer.