Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 04:42:04 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Remove unneeded globals and clean up some code in Friends component. See #3989.

File:
1 edited

Legend:

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

    r5704 r5712  
    11<?php
     2
     3/**
     4 * BuddyPress Friends Template Functions
     5 *
     6 * @package BuddyPress
     7 * @subpackage FriendsTemplate
     8 */
     9
    210// Exit if accessed directly
    311if ( !defined( 'ABSPATH' ) ) exit;
     
    5866 */
    5967function bp_friends_header_tabs() {
    60     global $bp; ?>
     68?>
    6169
    6270    <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() . '/my-friends/recently-active' ) ?>"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
     
    9199
    92100function bp_friends_random_friends() {
    93     global $bp;
    94101
    95102    if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) {
     
    123130
    124131        <?php } ?>
     132
    125133        <div class="clear"></div>
    126134    </div>
     135
    127136<?php
    128137}
     
    138147 */
    139148function bp_friends_random_members( $total_members = 5 ) {
    140     global $bp;
    141149
    142150    if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) {
     
    196204
    197205function bp_friend_search_form() {
    198     global $friends_template, $bp;
    199206
    200207    $action = bp_displayed_user_domain() . bp_get_friends_slug() . '/my-friends/search/';
    201     $label = __( 'Filter Friends', 'buddypress' ); ?>
     208    $label  = __( 'Filter Friends', 'buddypress' ); ?>
    202209
    203210        <form action="<?php echo $action ?>" id="friend-search-form" method="post">
     
    228235
    229236function bp_member_total_friend_count() {
    230     global $members_template;
    231 
    232237    echo bp_get_member_total_friend_count();
    233238}
     
    257262     * Returns the ID of the potential friend
    258263     *
    259      * @global object $bp
    260264     * @global object $friends_template
    261265     * @param int $user_id
     
    263267     */
    264268    function bp_get_potential_friend_id( $user_id = 0 ) {
    265         global $bp, $friends_template;
     269        global $friends_template;
    266270
    267271        if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) )
     
    278282 * Returns - 'is_friend', 'not_friends', 'pending'
    279283 *
    280  * @global object $bp
    281284 * @param int $potential_friend_id
    282285 * @return string
    283286 */
    284287function bp_is_friend( $user_id = 0 ) {
    285     global $bp;
    286288
    287289    if ( !is_user_logged_in() )
     
    301303}
    302304    function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
    303         global $bp, $friends_template;
    304305
    305306        if ( empty( $potential_friend_id ) )
     
    367368
    368369function bp_get_friend_ids( $user_id = 0 ) {
    369     global $bp;
    370 
    371     if ( !$user_id )
     370
     371    if ( empty( $user_id ) )
    372372        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    373373
     
    380380}
    381381function bp_get_friendship_requests() {
    382     global $bp;
    383 
    384382    return apply_filters( 'bp_get_friendship_requests', implode( ',', (array) friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) ) );
    385383}
     
    389387}
    390388    function bp_get_friend_friendship_id() {
    391         global $members_template, $bp;
     389        global $members_template;
    392390
    393391        if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
     
    403401}
    404402    function bp_get_friend_accept_request_link() {
    405         global $members_template, $bp;
     403        global $members_template;
    406404
    407405        if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
     
    417415}
    418416    function bp_get_friend_reject_request_link() {
    419         global $members_template, $bp;
     417        global $members_template;
    420418
    421419        if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
     
    439437}
    440438    function bp_friend_get_total_requests_count( $user_id = 0 ) {
    441         global $bp;
    442 
    443439        if ( empty( $user_id ) )
    444440            $user_id = bp_loggedin_user_id();
Note: See TracChangeset for help on using the changeset viewer.