Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/08/2011 01:14:31 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Use bp_displayed_user_id() rather than reference the $bp->displayed_user->id global var directly. First step at consolidating user ID checks to use WP_User class later. See #3738.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-template.php

    r4961 r5301  
    9393    global $bp;
    9494
    95     if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . $bp->displayed_user->id, 'bp' ) ) {
    96         $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
    97         wp_cache_set( 'friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp' );
     95    if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) {
     96        $friend_ids = BP_Friends_Friendship::get_random_friends( bp_displayed_user_id() );
     97        wp_cache_set( 'friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, 'bp' );
    9898    } ?>
    9999
    100100    <div class="info-group">
    101         <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>) <span><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>"><?php _e('See All', 'buddypress') ?></a></span></h4>
     101        <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ) ?>) <span><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>"><?php _e('See All', 'buddypress') ?></a></span></h4>
    102102
    103103        <?php if ( $friend_ids ) { ?>
     
    208208            <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
    209209
    210             <input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( $bp->displayed_user->id ) ?>" />
     210            <input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( bp_displayed_user_id() ) ?>" />
    211211
    212212        </form>
     
    268268            $user_id = $friends_template->friendship->friend->id;
    269269        else if ( empty( $user_id ) && !isset( $friends_template->friendship->friend ) )
    270             $user_id = $bp->displayed_user->id;
     270            $user_id = bp_displayed_user_id();
    271271
    272272        return apply_filters( 'bp_get_potential_friend_id', (int)$user_id );
     
    370370
    371371    if ( !$user_id )
    372         $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
     372        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
    373373
    374374    $friend_ids = friends_get_friend_user_ids( $user_id );
Note: See TracChangeset for help on using the changeset viewer.