Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/06/2009 03:07:48 AM (17 years ago)
Author:
apeatling
Message:

Converted $bp as an array to $bp as an object. See this post for more info: http://buddypress.org/forums/topic.php?id=1125

File:
1 edited

Legend:

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

    r884 r1021  
    2020                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : 10;
    2121
    22                 if ( $bp['current_action'] == 'my-friends' && $_POST['friend-search-box'] != '' ) {
     22                if ( $bp->current_action == 'my-friends' && $_POST['friend-search-box'] != '' ) {
    2323                       
    2424                        // Search results
    25                         $this->friendships = friends_search_friends( $_POST['friend-search-box'], $bp['current_userid'], $this->pag_num, $this->pag_page );
     25                        $this->friendships = friends_search_friends( $_POST['friend-search-box'], $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    2626                        $this->total_friend_count = (int)$this->friendships['total'];
    2727                        $this->friendships = $this->friendships['friends'];
    2828               
    29                 } else if ( $bp['current_action'] == 'requests' ) {
     29                } else if ( $bp->current_action == 'requests' ) {
    3030               
    3131                        // Friendship Requests
    32                         $this->friendships = friends_get_friendship_requests( $bp['current_userid'] );
     32                        $this->friendships = friends_get_friendship_requests( $bp->displayed_user->id );
    3333                        $this->total_friend_count = $this->friendships['total'];
    3434                        $this->friendships = $this->friendships['requests'];
    3535
    3636                } else {
    37                         $order = $bp['action_variables'][0];
     37                        $order = $bp->action_variables[0];
    3838                       
    3939                        if ( $order == 'newest' ) {
    40                                 $this->friendships = friends_get_newest( $bp['current_userid'], $this->pag_num, $this->pag_page );
     40                                $this->friendships = friends_get_newest( $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    4141                        } else if ( $order == 'alphabetically' ) {
    42                                 $this->friendships = friends_get_alphabetically( $bp['current_userid'], $this->pag_num, $this->pag_page );                             
     42                                $this->friendships = friends_get_alphabetically( $bp->displayed_user->id, $this->pag_num, $this->pag_page );                           
    4343                        } else {
    44                                 $this->friendships = friends_get_recently_active( $bp['current_userid'], $this->pag_num, $this->pag_page );     
     44                                $this->friendships = friends_get_recently_active( $bp->displayed_user->id, $this->pag_num, $this->pag_page );   
    4545                        }
    4646                       
     
    102102                $this->friendship = $this->next_friendship();
    103103               
    104                 if ( $bp['current_action'] == 'requests' ) {
     104                if ( $bp->current_action == 'requests' ) {
    105105                        $this->friendship = new BP_Friends_Friendship( $this->friendship );
    106106                } else {
     
    117117        global $bp, $friends_template;
    118118
    119         $friends_template = new BP_Friendship_Template( $bp['current_userid'] );
     119        $friends_template = new BP_Friendship_Template( $bp->displayed_user->id );
    120120       
    121121        return $friends_template->has_friendships();
     
    248248        global $friends_template, $bp;
    249249       
    250         echo apply_filters( 'bp_friend_accept_request_link', $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests/accept/' . $friends_template->friendship->id );
     250        echo apply_filters( 'bp_friend_accept_request_link', $bp->loggedin_user->domain . $bp->friends->slug . '/requests/accept/' . $friends_template->friendship->id );
    251251}
    252252
     
    254254        global $friends_template, $bp;
    255255       
    256         echo apply_filters( 'bp_friend_reject_request_link', $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests/reject/' . $friends_template->friendship->id );       
     256        echo apply_filters( 'bp_friend_reject_request_link', $bp->loggedin_user->domain . $bp->friends->slug . '/requests/reject/' . $friends_template->friendship->id );       
    257257}
    258258
     
    265265        global $friends_template, $bp;
    266266
    267         $action = $bp['current_domain'] . $bp['friends']['slug'] . '/my-friends/search/';
     267        $action = $bp->displayed_user->domain . $bp->friends->slug . '/my-friends/search/';
    268268        $label = __( 'Filter Friends', 'buddypress' );
    269269?>
    270270        <form action="<?php echo $action ?>" id="friend-search-form" method="post">
    271                 <label for="friend-search-box" id="friend-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp['friends']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>
     271                <label for="friend-search-box" id="friend-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp->friends->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>
    272272                <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
    273273                <?php if ( function_exists('wp_nonce_field') )
    274274                        wp_nonce_field('friend_search' );
    275275                ?>
    276                 <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp['current_userid'] ?>" />
     276                <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp->displayed_user->id ?>" />
    277277        </form>
    278278<?php
     
    281281function bp_friend_all_friends_link() {
    282282        global $bp;
    283         echo apply_filters( 'bp_friend_all_friends_link', $bp['current_domain'] . 'my-friends/all-friends' );
     283        echo apply_filters( 'bp_friend_all_friends_link', $bp->displayed_user->domain . 'my-friends/all-friends' );
    284284}
    285285
    286286function bp_friend_latest_update_link() {
    287287        global $bp;
    288         echo apply_filters( 'bp_friend_latest_update_link', $bp['current_domain'] . 'my-friends/last-updated' );       
     288        echo apply_filters( 'bp_friend_latest_update_link', $bp->displayed_user->domain . 'my-friends/last-updated' ); 
    289289}
    290290
    291291function bp_friend_recent_activity_link() {
    292292        global $bp;
    293         echo apply_filters( 'bp_friend_recent_activity_link', $bp['current_domain'] . 'my-friends/recently-active' );   
     293        echo apply_filters( 'bp_friend_recent_activity_link', $bp->displayed_user->domain . 'my-friends/recently-active' );     
    294294}
    295295
    296296function bp_friend_recent_status_link() {
    297297        global $bp;
    298         echo apply_filters( 'bp_friend_recent_status_link', $bp['current_domain'] . 'my-friends/status-updates' );     
     298        echo apply_filters( 'bp_friend_recent_status_link', $bp->displayed_user->domain . 'my-friends/status-updates' );       
    299299}
    300300
     
    307307                        $potential_friend_id = $friends_template->friendship->friend->id;
    308308                else if ( !$potential_friend_id && !$friends_template->friendship->friend )
    309                         $potential_friend_id = $bp['current_userid'];
    310 
    311                 if ( $bp['loggedin_userid'] == $potential_friend_id )
     309                        $potential_friend_id = $bp->displayed_user->id;
     310
     311                if ( $bp->loggedin_user->id == $potential_friend_id )
    312312                        return false;
    313313
    314                 $friend_status = BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $potential_friend_id );
     314                $friend_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
    315315
    316316                echo '<div class="friendship-button ' . $friend_status . '" id="friendship-button-' . $potential_friend_id . '">';
    317317                if ( $friend_status == 'pending' ) {
    318                         echo '<a class="requested" href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>';
     318                        echo '<a class="requested" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>';
    319319                } else if ( $friend_status == 'is_friend') {
    320                         echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>';
     320                        echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>';
    321321                } else {
    322                         echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>';
     322                        echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>';
    323323                }
    324324                echo '</div>';
     
    333333        global $bp, $create_group_step, $completed_to_step;
    334334?>
    335         <li<?php if ( !isset($bp['action_variables'][0]) || $bp['action_variables'][0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
    336         <li<?php if ( $bp['action_variables'][0] == 'newest' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>
    337         <li<?php if ( $bp['action_variables'][0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
     335        <li<?php if ( !isset($bp->action_variables[0]) || $bp->action_variables[0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
     336        <li<?php if ( $bp->action_variables[0] == 'newest' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>
     337        <li<?php if ( $bp->action_variables[0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
    338338<?php
    339339        do_action( 'friends_header_tabs' );
     
    343343        global $bp;
    344344       
    345         $current_filter = $bp['action_variables'][0];
     345        $current_filter = $bp->action_variables[0];
    346346       
    347347        switch ( $current_filter ) {
     
    361361        global $bp;
    362362       
    363         $friend_ids = BP_Friends_Friendship::get_random_friends( $bp['current_userid'] );
     363        $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
    364364?>     
    365365        <div class="info-group">
    366                 <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp['current_userid'] ) ?>)  <a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></h4>
     366                <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 ) ?>)  <a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></h4>
    367367               
    368368                <?php if ( $friend_ids ) { ?>
Note: See TracChangeset for help on using the changeset viewer.