I have create a code through which current user can add other users in 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 in database it sends email to them. I want to restrict sending mail to the current user. How to do?
$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@example.com'; wp_mail( $user_email, $subject, $message );
Please help me. Thanks...