Created
November 30, 2016 21:13
-
-
Save thomasplevy/a0d222d49240b88a4e2a5a22e78f2bc5 to your computer and use it in GitHub Desktop.
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 // don't add this to your functions.php file | |
/** | |
* Do something cool when user is removed from a membership | |
* @param int $student_id WP User ID | |
* @param int $membership_id WP Post ID of the Membership | |
* @return void | |
*/ | |
function my_unenrollment_acton( $student_id, $membership_id ) { | |
// add a usermeta value that the student used to be in this membership | |
$past = get_user_meta( $student_id, 'past_memberships', true ); | |
if ( ! $past ) { | |
$past = array(); | |
} | |
array_push( $past, $membership_id ); | |
update_user_meta( $student_id, 'past_memberships', $past ); | |
} | |
add_action( 'llms_user_removed_from_membership_level', 'my_unenrollment_acton', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment