LifterLMS: Email the Admin About New Enrollments
Emails you when a student is enrolled in a LifterLMS course, so you can welcome them personally or keep an eye on sales.
Opens WPIDE on
Code
if ( ! function_exists( 'llms_get_student' ) ) {
return;
}
add_action( 'llms_user_enrolled_in_course', function ( $user_id, $course_id ) {
$user = get_userdata( $user_id );
if ( ! $user ) {
return;
}
wp_mail(
get_option( 'admin_email' ),
sprintf( 'New enrollment: %s', get_the_title( $course_id ) ),
sprintf( "%s (%s) enrolled in \"%s\".", $user->display_name, $user->user_email, get_the_title( $course_id ) )
);
}, 10, 2 );
Notes
Fires for every enrollment trigger: purchases, memberships, vouchers and manual enrollments.
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.