Changeset 13092 for trunk/src/bp-friends/actions/add-friend.php
- Timestamp:
- 08/24/2021 04:16:17 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/actions/add-friend.php
r11931 r13092 1 1 <?php 2 2 /** 3 * Friends: Add action 3 * Friends: Add action. 4 4 * 5 5 * @package BuddyPress … … 14 14 */ 15 15 function friends_action_add_friend() { 16 if ( ! bp_is_friends_component() || !bp_is_current_action( 'add-friend' ) )16 if ( ! bp_is_friends_component() || ! bp_is_current_action( 'add-friend' ) ) { 17 17 return false; 18 } 18 19 19 if ( !$potential_friend_id = (int)bp_action_variable( 0 ) ) 20 $potential_friend_id = (int) bp_action_variable( 0 ); 21 if ( ! $potential_friend_id ) { 20 22 return false; 23 } 21 24 22 if ( $potential_friend_id == bp_loggedin_user_id() )25 if ( bp_loggedin_user_id() === $potential_friend_id ) { 23 26 return false; 27 } 24 28 25 29 $friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id ); 26 30 27 if ( 'not_friends' == $friendship_status ) {31 if ( 'not_friends' === $friendship_status ) { 28 32 29 if ( ! check_admin_referer( 'friends_add_friend' ) )33 if ( ! check_admin_referer( 'friends_add_friend' ) ) { 30 34 return false; 35 } 31 36 32 if ( ! friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {37 if ( ! friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) { 33 38 bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' ); 34 39 } else { 35 40 bp_core_add_message( __( 'Friendship requested', 'buddypress' ) ); 36 41 } 37 38 } elseif ( 'is_friend' == $friendship_status ) { 42 } elseif ( 'is_friend' === $friendship_status ) { 39 43 bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' ); 40 44 } else {
Note: See TracChangeset
for help on using the changeset viewer.