Mail to Teacher Role When New user Register.
-
Hello,
i am creating functionality of mail.
When new user / student will register on the site then teacher and admin get mail of new user registration.i tried
function custom_um_email_notifications_after_user_is_approved( $emails ) { //New email templates $custom_emails = array( 'teacher_email' => array( 'key' => 'teacher_email', 'title' => __( 'Account Welcome Email, Group 1', 'ultimate-member' ), 'subject' => 'Welcome to {site_name}!', 'body' => '', 'description' => __( 'Whether to send the user (Group 1) an email when his account is automatically approved.', 'ultimate-member' ), 'recipient' => 'user', 'default_active' => true ), 'admin_email' => array( 'key' => 'admin_email', 'title' => __( 'Account Welcome Email, Group 2', 'ultimate-member' ), 'subject' => 'Welcome to {site_name}!', 'body' => '', 'description' => __( 'Whether to send the user (Group 2) an email when his account is automatically approved.', 'ultimate-member' ), 'recipient' => 'user', 'default_active' => true ), ); // Default settings UM()->options()->options = array_merge( array( 'teacher_email_on' => 1, 'teacher_email_sub' => 'Welcome to {site_name}!', 'admin_email_on' => 1, 'admin_email_sub' => 'Welcome to {site_name}!', ), UM()->options()->options ); return array_merge( $custom_emails, $emails ); } add_filter( 'um_email_notifications', 'custom_um_email_notifications_after_user_is_approved' ); function registration_notification( $user_id, $args ) { um_fetch_user( $user_id ); $emails = um_multi_admin_email(); if(UM()->user()->get_role() == 'students'): UM()->mail()->send( $email, 'teacher_email' ); UM()->mail()->send( $email, 'admin_email'); endif; if ( ! empty( $emails ) ) { foreach ( $emails as $email ) { if ( um_user( 'account_status' ) != 'pending' ) { UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) ); } else { UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) ); } } } } add_action( 'um_registration_complete', 'registration_notification', 10, 2 );
but this code is not working..
please team help me to solve this issue..The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Mail to Teacher Role When New user Register.’ is closed to new replies.