# 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.

- Type: PHP
- Runs: Run everywhere
- Category: [Courses & Community](https://wpide.com/library/category/learning/)
- Tags: lifterlms, email, notifications
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/lifterlms-email-admin-course-completed/

## Code

```php
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 use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "LifterLMS: Course Completion Alerts for the Site Admin" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
