Created
August 17, 2017 18:01
-
-
Save bappi-d-great/7ba550e35f1b9250b24cfa383971b1f1 to your computer and use it in GitHub Desktop.
Auto enroll to a course based on Membership - CoursePress2 and Membership2
This file contains 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( 'ms_model_relationship_create_ms_relationship_before', 'ms_controller_member_assign_memberships_done_cb', 99, 4 ); | |
function ms_controller_member_assign_memberships_done_cb( $membership_id, $user_id, $gateway_id, $move_from_id ) { | |
$course = array( | |
// 'membership_id' => 'course_id' | |
'1324' => 6656, | |
'9087' => 22345 | |
); | |
CoursePress_Data_Course::enroll_student( $user_id, $course[$membership_id] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it doesnt work when i add same membership to tow courses, it enrolls only in one course for the same membership , any thoughts?