Created
January 2, 2015 15:08
-
-
Save bappi-d-great/671b368116301c6e8c81 to your computer and use it in GitHub Desktop.
Auto enroll to courses when an member is registered
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'user_register', 'user_register_cb', 10, 1 ); | |
function user_register_cb( $user_id ){ | |
//You need to provide the course IDs in the following array | |
$courses = array( 102, 322, 424 ); | |
$student = new Student( $user_id ); | |
foreach( $courses as $course ){ | |
$student->enroll_in_course( $course ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment