diff --git src/bp-templates/bp-nouveau/includes/friends/ajax.php src/bp-templates/bp-nouveau/includes/friends/ajax.php
index 7fb0087bb..25b970131 100644
|
|
|
function bp_nouveau_ajax_addremove_friend() { |
| 96 | 96 | // Cast fid as an integer. |
| 97 | 97 | $friend_id = (int) $_POST['item_id']; |
| 98 | 98 | |
| 99 | | $user = get_user_by( 'id', $friend_id ); |
| 100 | | if ( ! $user ) { |
| 101 | | wp_send_json_error( |
| 102 | | array( |
| 103 | | 'feedback' => sprintf( |
| 104 | | '<div class="bp-feedback error">%s</div>', |
| 105 | | esc_html__( 'No member found by that ID.', 'buddypress' ) |
| 106 | | ), |
| 107 | | ) |
| 108 | | ); |
| | 99 | // Check if the user exists only when the Friend ID is not a Frienship ID. |
| | 100 | if ( isset( $_POST['action'] ) && $_POST['action'] !== 'friends_accept_friendship' && $_POST['action'] !== 'friends_reject_friendship' ) { |
| | 101 | $user = get_user_by( 'id', $friend_id ); |
| | 102 | if ( ! $user ) { |
| | 103 | wp_send_json_error( |
| | 104 | array( |
| | 105 | 'feedback' => sprintf( |
| | 106 | '<div class="bp-feedback error">%s</div>', |
| | 107 | esc_html__( 'No member found by that ID.', 'buddypress' ) |
| | 108 | ), |
| | 109 | ) |
| | 110 | ); |
| | 111 | } |
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | // In the 2 first cases the $friend_id is a friendship id. |