Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Created November 7, 2016 23:39
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/e029a0218b92acd3b97a2ebd62f15bd1 to your computer and use it in GitHub Desktop.
Save thomasplevy/e029a0218b92acd3b97a2ebd62f15bd1 to your computer and use it in GitHub Desktop.
<?php // don't add this to your functions.php file
/**
* Add a custom value to a user meta field on lesson completion
* @param int $user_id WP User ID
* @param int $lesson_id WP Post ID of the lesson
* @return void
*/
function my_lesson_completion_action( $user_id, $lesson_id ) {
update_user_meta( $user_id, 'last_lesson_completed', $lesson_id );
}
add_action( 'lifterlms_lesson_completed', 'my_lesson_completion_action', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment