Raise membership level upon course completion (Learndash)
-
Hi,
I’m hoping someone else might be able to shed light on this. In particular this could be useful for anyone else also using PMPro and Learndash.
I’d like to automatically raise a member by one level upon completion of a course. My PHP skills are by *no* means excellent, and to be perfectly honest this code breaks my site. But I’ll put it out there, because any assistance would be of great help!
$current_user = wp_get_current_user(); global $user_id = $current_user->ID; add_action('learndash_course_completed', function($data) { //get membership level, then ++ it if (pmpro_hasMembershipLevel()) { $membership_level = $current_user->membership_id; if(pmpro_hasMembershipLevel($membership_level)) { $membership_level++; pmpro_changeMembershipLevel($membership_level, $user_id); } } }, 5, 1);
I’m not sure if my problem is that I don’t understand how the $data in “learndash_course_completed” works (have posted in LD for thsi also). In my experience with creating functions in wordpress, you write the hook and function separately…
- The topic ‘Raise membership level upon course completion (Learndash)’ is closed to new replies.