# LearnDash: Enrolled Courses Column in Users

> Adds a "Courses" column to the Users screen showing how many LearnDash courses each user is enrolled in and how many they have completed.

- Type: PHP
- Runs: Admin only
- Category: [Courses & Community](https://wpide.com/library/category/learning/)
- Tags: learndash, users, reporting
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/learndash-enrolled-courses-users-column/

## Code

```php
if ( ! defined( 'LEARNDASH_VERSION' ) ) {
    return;
}

add_filter( 'manage_users_columns', function ( $columns ) {
    $columns['wpide_ld_courses'] = 'Courses';

    return $columns;
} );

add_filter( 'manage_users_custom_column', function ( $output, $column, $user_id ) {
    if ( 'wpide_ld_courses' !== $column ) {
        return $output;
    }

    $courses = (array) learndash_user_get_enrolled_courses( $user_id );

    if ( ! $courses ) {
        return '&mdash;';
    }

    $done = 0;

    foreach ( $courses as $course_id ) {
        if ( learndash_course_completed( $user_id, $course_id ) ) {
            $done++;
        }
    }

    return esc_html( sprintf( '%1$d enrolled, %2$d completed', count( $courses ), $done ) );
}, 10, 3 );
```

## Notes

Uses LearnDash's own enrollment data, which LearnDash caches per user.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "LearnDash: Enrolled Courses Column in Users" 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/
