Skip to:
Content

BuddyPress.org


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

    r5416 r5712  
    11<?php
     2
     3/**
     4 * BuddyPress Friends Activity Functions
     5 *
     6 * These functions handle the recording, deleting and formatting of activity
     7 * for the user and for this specific component.
     8 *
     9 * @package BuddyPress
     10 * @subpackage FriendsActivity
     11 */
     12
    213// Exit if accessed directly
    314if ( !defined( 'ABSPATH' ) ) exit;
    415
    516function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
    6     global $bp;
    717
    818    $initiator_name = bp_core_get_user_displayname( $initiator_id );
     
    1121        return false;
    1222
    13     $ud = get_userdata( $friend_id );
    14     $initiator_ud = get_userdata( $initiator_id );
    15 
     23    $ud                = get_userdata( $friend_id );
    1624    $all_requests_link = bp_core_get_user_domain( $friend_id ) . bp_get_friends_slug() . '/requests/';
    17     $settings_slug    = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    18     $settings_link    = trailingslashit( bp_core_get_user_domain( $friend_id ) .  $settings_slug . '/notifications' );
    19     $initiator_link   = bp_core_get_user_domain( $initiator_id );
     25    $settings_slug     = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
     26    $settings_link     = trailingslashit( bp_core_get_user_domain( $friend_id ) .  $settings_slug . '/notifications' );
     27    $initiator_link    = bp_core_get_user_domain( $initiator_id );
    2028
    2129    // Set up and send the message
     
    4755
    4856function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
    49     global $bp;
    50 
    51     $friendship = new BP_Friends_Friendship( $friendship_id, false, false );
    5257
    5358    $friend_name = bp_core_get_user_displayname( $friend_id );
    5459
    55     if ( 'no' == bp_get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) )
     60    if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) )
    5661        return false;
    5762
    58     $ud = get_userdata( $initiator_id );
    59 
     63    $ud            = get_userdata( $initiator_id );
    6064    $friend_link   = bp_core_get_user_domain( $friend_id );
    6165    $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
Note: See TracChangeset for help on using the changeset viewer.