Created
June 6, 2020 02:00
-
-
Save MrVibe/cdfe2c8ae7a3b8aa963420ecbda66f61 to your computer and use it in GitHub Desktop.
Send email to administrator when user registers form custom registration form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wplms_custom_registration_form_user_added',function($user_id,$user_args,$settings){ | |
$admins = get_users('role=Administrator'); | |
$admin_emails = []; //PHP 7.2+ else change to $admin_Emails = array(); | |
foreach ($blogusers as $user) { | |
$admin_emails[]=$user->user_email; | |
} | |
$admin_emails = implode(',',$admin_emails); | |
$subject = 'User registered in site'; | |
$body = 'The user '.$user_args['user_email'].' registered in your site'; | |
$headers = array('Content-Type: text/html; charset=UTF-8','From: YourSite <FROM EMAIL.com>'); | |
wp_mail( $admin_emails, $subject, $message, $headers, $attachments ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment