Skip to content

Instantly share code, notes, and snippets.

@Anshu-wwc
Forked from thomasplevy/llms-cert-trigger.php
Created April 21, 2022 10:45
Show Gist options
  • Save Anshu-wwc/a291e74f91f95ed61f12669b6f5cbcd9 to your computer and use it in GitHub Desktop.
Save Anshu-wwc/a291e74f91f95ed61f12669b6f5cbcd9 to your computer and use it in GitHub Desktop.
<?php
$certs = LLMS()->certificates(); // our certs class
$cert_id = 123; // this should be the WP Post ID of the certificate you created on the admin panel via LLMS
$related_post_id = 456; // this is really for record keeping only at the moment
// should be the WP post id of the course, lesson, or section which
// the student has completed to earn the certificate
$students = new WP_User_Query(); // get your students however you see fit
if ( ! empty( $students->results ) ) {
foreach ( $students->results as $student ) {
$certs->trigger_engagement( $student->ID, $certificate_id, $related_post_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment