I have created a code through which the current user can add other users to his project. These users are only shown on the project page. They will not have any right to modify the project.
Once these users are inserted to database it sends an email to them. I want to restrict sending mail to the current user. How can I do that?
$member_details->user_email = array_map( 'sanitize_text_field', $_POST['user_email'] ); $member_details->user_role = array_map( 'sanitize_text_field', $_POST['user_role'] ); $member_details->status = array_map( 'sanitize_text_field', $_POST['status'] ); $member_details_encode = wp_json_encode( $member_details ); global $wpdb; $member_result = $wpdb->insert( 'wpxa_project_members', array( 'project_id' => $_SESSION['project_id'], 'author_id' => $post_author, 'member_details' => $member_details_encode ), array( '%d', '%d', '%s' ) ); $user_email = $member_details->user_email; $subject = "Congrats! You are added to the Project - " . "'" . $project_title . "'"; $message = 'If you are not the member of project plz contact us to remove at [email protected]'; wp_mail( $user_email, $subject, $message );