Changeset 4845 for trunk/bp-friends/bp-friends-actions.php
- Timestamp:
- 07/25/2011 12:11:32 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-actions.php
r4822 r4845 10 10 11 11 function friends_action_add_friend() { 12 global $bp;13 14 12 if ( !bp_is_friends_component() || !bp_is_current_action( 'add-friend' ) ) 15 13 return false; 16 14 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 ) ) 20 16 return false; 21 17 22 if ( $potential_friend_id == $bp->loggedin_user->id)18 if ( $potential_friend_id == bp_loggedin_user_id() ) 23 19 return false; 24 20 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 ); 26 22 27 23 if ( 'not_friends' == $friendship_status ) { … … 30 26 return false; 31 27 32 if ( !friends_add_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {28 if ( !friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) { 33 29 bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' ); 34 30 } else { … … 49 45 50 46 function friends_action_remove_friend() { 51 global $bp;52 53 47 if ( !bp_is_friends_component() || !bp_is_current_action( 'remove-friend' ) ) 54 48 return false; 55 49 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 ) ) 59 51 return false; 60 52 61 if ( $potential_friend_id == $bp->loggedin_user->id)53 if ( $potential_friend_id == bp_loggedin_user_id() ) 62 54 return false; 63 55 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 ); 65 57 66 58 if ( 'is_friend' == $friendship_status ) { … … 69 61 return false; 70 62 71 if ( !friends_remove_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {63 if ( !friends_remove_friend( bp_loggedin_user_id(), $potential_friend_id ) ) { 72 64 bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' ); 73 65 } else {
Note: See TracChangeset
for help on using the changeset viewer.