Certificate and Tracking Hooks
Use these hooks to react to certificate lifecycle events, tune certificate PDF rendering, and observe course progress/status updates.
Only custom MentorKit hooks from docs-lms/hook-metadata.json are documented here. Classic WordPress, WooCommerce, Polylang, Astra, and other external hooks are intentionally excluded.
Documented hooks: 10.
Documented Hooks
| Hook | Type | Status |
|---|---|---|
| scorm_after_course_progress | Action | Public |
| scorm_before_course_progress | Action | Public |
| scorm_certificate_deleted | Action | Public |
| scorm_certificate_pdf_pixel_ratio | Filter | Public |
| scorm_certificate_revoked | Action | Public |
| scorm_group_certificate_revoked | Action | Public |
| scorm_my_profile_user_certificates | Filter | Public |
| scorm_my_profile_user_group_certificates | Filter | Public |
| scorm_player_course_manually_completed | Action | Public |
| scorm_player_status_updated | Action | Public |
scorm_after_course_progress
Type: Action
Category: Certificate/Tracking
Source: templates/single-scorm_package.php:210, templates/single-scorm_package_minimal.php:194
Status: Public
When It Runs
Fires after course progress. The source call is inside templates/single-scorm_package.php. This hook appears in 2 source locations.
Parameters
This hook is called from multiple source locations with different source signatures.
| Source | Callback parameters |
|---|---|
templates/single-scorm_package.php:210 | $scorm_course_id from $scorm_course_id$post from $post$scorm_course_status from $scorm_course_status$scorm_progress_text from $scorm_progress_text |
templates/single-scorm_package_minimal.php:194 | $scorm_course_id from $scorm_course_id$post from $post$scorm_progress_status from $scorm_progress_status$scorm_progress_text from $scorm_progress_text |
Example
add_action(
'scorm_after_course_progress',
function ( $scorm_course_id, $post, $scorm_course_status, $scorm_progress_text ) {
// Add your integration logic here.
},
10,
4
);
Notes
- Because the source signatures differ, write callbacks defensively when attaching the same callback across all contexts.
- Parameter names vary between call sites.
scorm_before_course_progress
Type: Action
Category: Certificate/Tracking
Source: templates/single-scorm_package.php:204, templates/single-scorm_package_minimal.php:187
Status: Public
When It Runs
Fires before course progress. The source call is inside templates/single-scorm_package.php. This hook appears in 2 source locations.
Parameters
This hook is called from multiple source locations with different source signatures.
| Source | Callback parameters |
|---|---|
templates/single-scorm_package.php:204 | $scorm_course_id from $scorm_course_id$post from $post$scorm_course_status from $scorm_course_status$scorm_progress_text from $scorm_progress_text |
templates/single-scorm_package_minimal.php:187 | $scorm_course_id from $scorm_course_id$post from $post$scorm_progress_status from $scorm_progress_status$scorm_progress_text from $scorm_progress_text |
Example
add_action(
'scorm_before_course_progress',
function ( $scorm_course_id, $post, $scorm_course_status, $scorm_progress_text ) {
// Add your integration logic here.
},
10,
4
);
Notes
- Because the source signatures differ, write callbacks defensively when attaching the same callback across all contexts.
- Parameter names vary between call sites.
scorm_certificate_deleted
Type: Action
Category: Certificate/Tracking
Source: includes/certificates/cpt-registration.php:2919
Status: Public
When It Runs
Fires when certificate deleted. The source call is inside scorm_player_delete_user_certificate(). Source context: Delete a user's certificate for a specific course.
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$user_id | $user_id | Additional context passed by the hook. |
$course_id | $course_id | Additional context passed by the hook. |
$certificate_id | $certificate_id | Additional context passed by the hook. |
Example
add_action(
'scorm_certificate_deleted',
function ( $user_id, $course_id, $certificate_id ) {
// Add your integration logic here.
},
10,
3
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_certificate_pdf_pixel_ratio
Type: Filter
Category: Certificate/Tracking
Source: includes/certificates/canvas-preview.php:20, includes/certificates/cpt-registration.php:1721
Status: Public
When It Runs
Filters the certificate PDF pixel ratio. The source call is inside scorm_player_get_certificate_preview_pixel_ratio(). Source context: Get the shared client-side PDF pixel ratio for certificate previews/downloads. This hook appears in 2 source locations.
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$pixel_ratio | 3 | Value passed through the filter. Source default: 3. |
Return Value
Return the filtered $pixel_ratio value. Source default: 3. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'scorm_certificate_pdf_pixel_ratio',
function ( $pixel_ratio ) {
return $pixel_ratio;
},
10,
1
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_certificate_revoked
Type: Action
Category: Certificate/Tracking
Source: includes/certificates/cpt-registration.php:2879
Status: Public
When It Runs
Fires when certificate revoked. The source call is inside scorm_player_revoke_user_certificate(). Source context: Remove a certificate from a user (for admin purposes).
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$user_id | $user_id | Additional context passed by the hook. |
$course_id | $course_id | Additional context passed by the hook. |
$certificate_id | $certificate_id | Additional context passed by the hook. |
Example
add_action(
'scorm_certificate_revoked',
function ( $user_id, $course_id, $certificate_id ) {
// Add your integration logic here.
},
10,
3
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_group_certificate_revoked
Type: Action
Category: Certificate/Tracking
Source: includes/utils/tracking.php:1263
Status: Public
When It Runs
Fires when group certificate revoked. The source call is inside scorm_player_revoke_user_group_certificate(). Source context: Remove a group certificate from a user (for admin purposes).
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$user_id | $user_id | Additional context passed by the hook. |
$group_id | $group_id | Additional context passed by the hook. |
$certificate_id | $certificate_id | Additional context passed by the hook. |
Example
add_action(
'scorm_group_certificate_revoked',
function ( $user_id, $group_id, $certificate_id ) {
// Add your integration logic here.
},
10,
3
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_my_profile_user_certificates
Type: Filter
Category: Certificate/Tracking
Source: includes/frontend/my-courses-shortcode.php:74
Status: Public
When It Runs
Filters my profile user certificates. The source call is inside SCORM_My_Profile_Shortcode::render_my_profile().
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$user_certificates | $user_certificates | Value passed through the filter. Source default: $user_certificates. |
$current_user_id | $current_user_id | Additional context passed by the hook. |
$attributes | $attributes | Additional context passed by the hook. |
Return Value
Return the filtered $user_certificates value. Source default: $user_certificates. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'scorm_my_profile_user_certificates',
function ( $user_certificates, $current_user_id, $attributes ) {
return $user_certificates;
},
10,
3
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_my_profile_user_group_certificates
Type: Filter
Category: Certificate/Tracking
Source: includes/frontend/my-courses-shortcode.php:75
Status: Public
When It Runs
Filters my profile user group certificates. The source call is inside SCORM_My_Profile_Shortcode::render_my_profile().
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$user_group_certificates | $user_group_certificates | Value passed through the filter. Source default: $user_group_certificates. |
$current_user_id | $current_user_id | Additional context passed by the hook. |
$attributes | $attributes | Additional context passed by the hook. |
Return Value
Return the filtered $user_group_certificates value. Source default: $user_group_certificates. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'scorm_my_profile_user_group_certificates',
function ( $user_group_certificates, $current_user_id, $attributes ) {
return $user_group_certificates;
},
10,
3
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_player_course_manually_completed
Type: Action
Category: Certificate/Tracking
Source: includes/admin/manual-completion.php:208
Status: Public
When It Runs
Fires when course manually completed. The source call is inside scorm_player_mark_course_complete(). Source context: Mark a course as manually completed for a user.
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$target_id | $target_id | Additional context passed by the hook. |
$course_id | $course_id | Additional context passed by the hook. |
$admin_id | $admin_id | Additional context passed by the hook. |
$reason | $reason | Additional context passed by the hook. |
$audit_id | $audit_id | Additional context passed by the hook. |
Example
add_action(
'scorm_player_course_manually_completed',
function ( $target_id, $course_id, $admin_id, $reason, $audit_id ) {
// Add your integration logic here.
},
10,
5
);
Notes
- Keep callbacks small and scoped to the source context shown above.
scorm_player_status_updated
Type: Action
Category: Certificate/Tracking
Source: includes/utils/tracking.php:284
Status: Public
When It Runs
Fires when status updated. The source call is inside scorm_player_update_scorm_status(). Source context: Updates the SCORM status for a user and package, respecting the status hierarchy.
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$user_id | $user_id | Additional context passed by the hook. |
$scorm_id | $scorm_id | Additional context passed by the hook. |
$new_status | $new_status | Additional context passed by the hook. |
$score | $score | Additional context passed by the hook. |
Example
add_action(
'scorm_player_status_updated',
function ( $user_id, $scorm_id, $new_status, $score ) {
// Add your integration logic here.
},
10,
4
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.