Coursepress Pro – changes to registration functions

We have a standalone page we use for user registration. Up until Coursepress Pro v2 we were able to register new students with these two lines of code (using the WordPress user_id) :

$student = new Student( $user_id );

$student->enroll_in_course( $course_id );

These two lines don’t work any more as many of the classes and functions have changed in Coursepress 2. Can someone please tell me how to register students? I’m assuming it has something to do with the update_course function in class-course.php and the ‘enroll_student’ action – CoursePress_Data_Course::enroll_student( $data->data->student_id, $data->data->course_id ); – not sure how to do this in an external PHP script though.

For Coursepress version 1 we just needed to reference the necessary WordPress scripts and the $wpdb variable:

include $blogpath.’/wp-blog-header.php’;

include $blogpath.’/wp-includes/registration.php’;

include $blogpath.’/wp-includes/pluggable.php’;

global $wpdb;

We could then programatically add a new WordPress user and then use those two lines I mentioned to add them to a course.