Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Last active November 30, 2016 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasplevy/4ba08cd8c38d8f06c5a8a5752ecd0f77 to your computer and use it in GitHub Desktop.
Save thomasplevy/4ba08cd8c38d8f06c5a8a5752ecd0f77 to your computer and use it in GitHub Desktop.
<?php // don't add this to your functions.php file
/**
* Do something cool upon user enrollment in a membership
* @param int $student_id WP User ID
* @param int $membership_id WP Post ID of the Membership
* @return void
*/
function my_enrollment_acton( $student_id, $membership_id ) {
// add the last course a user enrolled in to the usermeta table
update_user_meta( $student_id, 'last_enrollment_id', $membership_id );
}
add_action( 'llms_user_added_to_membership_level', 'my_enrollment_acton', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment