LifterLMS: Course Completion Alerts for the Site Admin
Emails you whenever a student completes a LifterLMS course, with their name, email and a link to their reporting page.
Opens WPIDE on
Code
if ( ! function_exists( 'llms_get_student' ) ) {
return;
}
$wpide_llms_notify_emails = array( get_option( 'admin_email' ) );
add_action( 'lifterlms_course_completed', function ( $user_id, $course_id ) use ( $wpide_llms_notify_emails ) {
$user = get_userdata( $user_id );
if ( ! $user ) {
return;
}
wp_mail(
$wpide_llms_notify_emails,
sprintf( 'Course completed: %s', get_the_title( $course_id ) ),
sprintf(
"%s (%s) completed \"%s\".\n\nStudent report: %s",
$user->display_name,
$user->user_email,
get_the_title( $course_id ),
admin_url( 'admin.php?page=llms-reporting&tab=students&student_id=' . (int) $user_id )
)
);
}, 10, 2 );
Notes
Add more recipients to $wpide_llms_notify_emails.
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.