Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Created August 28, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thomasplevy/52989e1460cd4a4d4228302f3947a228 to your computer and use it in GitHub Desktop.
Save thomasplevy/52989e1460cd4a4d4228302f3947a228 to your computer and use it in GitHub Desktop.
<?php
add_action( 'init', 'my_manual_achievement' );
function my_manual_achievement() {
$user_id = 123; // WP User ID of the user you want to award an achievement to
$achievement_id = 456; // WP Post ID of the LifterLMS Achievement Post you want to award to the user
$post_id = 5202; // The Releated WP Post ID that triggered the awarding of this achievement. This could be a Course, Lesson, Section, or Quiz ID
$achievements = LLMS()->achievements();
$achievements->trigger_engagement( $user_id, $achievement_id, $post_id );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment