How to auto enroll newly registered users to a specific course?

I have a requirement by my client and need your help to get it done. CPP... They want all new registrations to be auto-enrolled in our first course and then all logins to redirect to "Dashboard"
I got the redirect done with your login redirect plugin to dashboard but we want no one's dashboard to be blank. They have to be enrolled into our first / intro class.
I figure this could be done with a mu-plugin and hook?
If I can get pointed in the right direction I'll figure it out.

  • Nastia

    Hello us-Sunnah , Hope you are doing well!

    Since our last conversation in chat, I've created a thread in our forums with a solution to enroll all new students to all available courses. You can find this thread here.

    Our developers provided a solution here as well. Instead of using the mu-plugin suggested in the previous thread, add this code to functions.php of your theme:

    add_action('user_register', 'coursepress_custom_enroll_for_specific');
    function coursepress_custom_enroll_for_specific( $student_id ) {
        $course_id = 76;
        CoursePress_Data_Course::enroll_student( $student_id, $course_id );

    Where the $course_id = 76 contains the ID of Beginners course of your site. If you wish to add students to another course, please change the ID within $course_id = 76;

    This way, new users will be enrolled in a specific course.

    Hope this will help!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.