我创建了一个代码,当前用户可以通过该代码将其他用户添加到他的项目中。这些用户仅显示在项目页面上。他们无权修改该项目。
一旦这些用户被插入数据库,它就会向他们发送一封电子邮件。我想限制向当前用户发送邮件。我该怎么做?
$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 );