Tutor LMS: Email the Admin About New Student Sign-Ups
Emails the site admin when someone registers through the Tutor LMS student registration form.
Opens WPIDE on
Code
if ( ! function_exists( 'tutor_utils' ) ) {
return;
}
add_action( 'tutor_after_student_signup', function ( $user_id ) {
$user = get_userdata( $user_id );
if ( ! $user ) {
return;
}
wp_mail(
get_option( 'admin_email' ),
sprintf( '[%s] New student: %s', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), $user->display_name ),
sprintf( "A new student signed up.\n\nName: %s\nEmail: %s\nProfile: %s", $user->display_name, $user->user_email, admin_url( 'user-edit.php?user_id=' . (int) $user_id ) )
);
} );
Notes
Only Tutor's student sign-up form triggers this email, not other registration forms.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.