Created
November 7, 2016 23:39
-
-
Save thomasplevy/e029a0218b92acd3b97a2ebd62f15bd1 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 | |
/** | |
* 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