Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/25/2011 12:11:32 AM (14 years ago)
Author:
boonebgorges
Message:

Global/slug audit in Friends component. See #3325

File:
1 edited

Legend:

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

    r4822 r4845  
    1010
    1111function friends_action_add_friend() {
    12     global $bp;
    13 
    1412    if ( !bp_is_friends_component() || !bp_is_current_action( 'add-friend' ) )
    1513        return false;
    1614
    17     $potential_friend_id = $bp->action_variables[0];
    18 
    19     if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) )
     15    if ( !$potential_friend_id = (int)bp_action_variable( 0 ) )
    2016        return false;
    2117
    22     if ( $potential_friend_id == $bp->loggedin_user->id )
     18    if ( $potential_friend_id == bp_loggedin_user_id() )
    2319        return false;
    2420
    25     $friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
     21    $friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id );
    2622
    2723    if ( 'not_friends' == $friendship_status ) {
     
    3026            return false;
    3127
    32         if ( !friends_add_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
     28        if ( !friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {
    3329            bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' );
    3430        } else {
     
    4945
    5046function friends_action_remove_friend() {
    51     global $bp;
    52 
    5347    if ( !bp_is_friends_component() || !bp_is_current_action( 'remove-friend' ) )
    5448        return false;
    5549
    56     $potential_friend_id = $bp->action_variables[0];
    57 
    58     if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) )
     50    if ( !$potential_friend_id = (int)bp_action_variable( 0 ) )
    5951        return false;
    6052
    61     if ( $potential_friend_id == $bp->loggedin_user->id )
     53    if ( $potential_friend_id == bp_loggedin_user_id() )
    6254        return false;
    6355
    64     $friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
     56    $friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id );
    6557
    6658    if ( 'is_friend' == $friendship_status ) {
     
    6961            return false;
    7062
    71         if ( !friends_remove_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
     63        if ( !friends_remove_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {
    7264            bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' );
    7365        } else {
Note: See TracChangeset for help on using the changeset viewer.