Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 04:42:04 AM (15 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-functions.php

    r5676 r5712  
    11<?php
    2 /********************************************************************************
    3  * Business Functions
     2
     3/**
     4 * BuddyPress Friends Functions
    45 *
    5  * Business functions are where all the magic happens in BuddyPress. They will
     6 * Functions are where all the magic happens in BuddyPress. They will
    67 * handle the actual saving or manipulation of information. Usually they will
    78 * hand off to a database class for data access, then return
    89 * true or false on success or failure.
     10 *
     11 * @package BuddyPress
     12 * @subpackage FriendsFunctions
    913 */
    1014
    … …  
    5357
    5458function friends_remove_friend( $initiator_userid, $friend_userid ) {
    55         global $bp;
    5659
    5760        $friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
    … …  
    138141
    139142function friends_check_friendship( $user_id, $possible_friend_id ) {
    140         global $bp;
    141143
    142144        if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id ) )
    … …  
    152154
    153155function friends_get_total_friend_count( $user_id = 0 ) {
    154         global $bp;
    155 
    156         if ( !$user_id )
     156
     157        if ( empty( $user_id ) )
    157158                $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    158159
    … …  
    182183}
    183184
    184 function friends_get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false, $filter = false ) {
     185function friends_get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
    185186        return BP_Friends_Friendship::get_friend_user_ids( $user_id, $friend_requests_only, $assoc_arr );
    186187}
    … …  
    293294
    294295function friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page = 0 ) {
    295         global $bp;
    296296
    297297        $user_ids = BP_Friends_Friendship::search_users( $search_terms, $user_id, $pag_num, $pag_page );
    298298
    299         if ( !$user_ids )
     299        if ( empty( $user_ids ) )
    300300                return false;
    301301
     302        $users = array();
    302303        for ( $i = 0, $count = count( $user_ids ); $i < $count; ++$i )
    303304                $users[] = new BP_Core_User( $user_ids[$i] );
    … …  
    312313
    313314function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
    314         global $bp;
    315315
    316316        if ( 'add' == $status ) {
    … …  
    328328        do_action( 'friends_before_remove_data', $user_id );
    329329
    330         BP_Friends_Friendship::delete_all_for_user($user_id);
     330        BP_Friends_Friendship::delete_all_for_user( $user_id );
    331331
    332332        // Remove usermeta
Note: See TracChangeset for help on using the changeset viewer.