Webhook Hooks
Use these hooks to observe events that feed MentorKit webhook delivery and to filter the generated webhook payload envelope.
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: 8.
Documented Hooks
| Hook | Type | Status |
|---|---|---|
| scorm_certificate_awarded | Action | Public |
| scorm_course_retake_started | Action | Public |
| scorm_enrollment_created | Action | Public |
| scorm_group_certificate_awarded | Action | Public |
| scorm_group_completed | Action | Public |
| scorm_group_retake_started | Action | Public |
| scorm_player_course_status_transition | Action | Public |
| scorm_player_webhook_payload | Filter | Public |
scorm_certificate_awarded
Type: Action
Category: Webhook
Source: includes/certificates/cpt-registration.php:2596
Status: Public
When It Runs
Fires when certificate awarded. The source call is inside scorm_player_award_certificate(). Source context: Award a certificate to a user.
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. |
$certificate_data | $certificate_data | Additional context passed by the hook. |
Example
add_action(
'scorm_certificate_awarded',
function ( $user_id, $course_id, $certificate_id, $certificate_data ) {
// Add your integration logic here.
},
10,
4
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
scorm_course_retake_started
Type: Action
Category: Webhook
Source: includes/utils/tracking.php:485
Status: Public
When It Runs
Fires when course retake started. The source call is inside scorm_player_reset_course_attempt(). Source context: Reset a user's SCORM attempt for a course, preparing for a retake.
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. |
Example
add_action(
'scorm_course_retake_started',
function ( $user_id, $course_id ) {
// Add your integration logic here.
},
10,
2
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
scorm_enrollment_created
Type: Action
Category: Webhook
Source: includes/admin/course-enrollments.php:154, includes/frontend/group-handlers.php:562, includes/woocommerce/woocommerce-integration.php:415, includes/woocommerce/woocommerce-integration.php:474
Status: Public
When It Runs
Fires when enrollment created. The source call is inside scorm_player_ajax_enrollments_enroll_user(). Source context: AJAX: Enroll a user in a course or group. This hook appears in 4 source locations.
Parameters
This hook is called from multiple source locations with different source signatures.
| Source | Callback parameters |
|---|---|
includes/admin/course-enrollments.php:154 | $user_id from $user_id$object_type from 'course'$post_id from $post_id$source from 'admin'$context from array() |
includes/frontend/group-handlers.php:562 | $user_id from $user_id$object_type from 'group'$group_id from $group_id$source from $source$context from is_array($context) ? $context : array() |
includes/woocommerce/woocommerce-integration.php:415 | $customer_id from $customer_id$object_type from 'group'$group_id from $group_id$source from 'woocommerce'$context from array('order_id' => (int) $order_id, 'product_id' => (int) $product->get_id(),) |
includes/woocommerce/woocommerce-integration.php:474 | $customer_id from $customer_id$object_type from 'course'$course_id from $course->ID$source from 'woocommerce'$context from array('order_id' => (int) $order_id, 'product_id' => (int) $product->get_id(),) |
Example
add_action(
'scorm_enrollment_created',
function ( $user_id, $object_type, $post_id, $source, $context ) {
// Add your integration logic here.
},
10,
5
);
Notes
- Because the source signatures differ, write callbacks defensively when attaching the same callback across all contexts.
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
- Parameter names vary between call sites.
scorm_group_certificate_awarded
Type: Action
Category: Webhook
Source: includes/utils/tracking.php:995
Status: Public
When It Runs
Fires when group certificate awarded. The source call is inside scorm_player_award_group_certificate(). Source context: Award a group certificate to a user.
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. |
$certificate_data | $certificate_data | Additional context passed by the hook. |
Example
add_action(
'scorm_group_certificate_awarded',
function ( $user_id, $group_id, $certificate_id, $certificate_data ) {
// Add your integration logic here.
},
10,
4
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
scorm_group_completed
Type: Action
Category: Webhook
Source: includes/utils/tracking.php:826
Status: Public
When It Runs
Fires when group completed. The source call is inside scorm_player_recalculate_group_progress(). Source context: Recalculate group progress based on current course statuses.
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. |
$completion_data | array('total_courses' => $total_courses, 'completed_courses' => $completed_courses, 'in_progress_courses' => $in_progress_courses, 'progress_percentage' => $progress_percentage, 'status' => $group_status, 'completed_at' => $completed_at,) | Additional context passed by the hook. |
Example
add_action(
'scorm_group_completed',
function ( $user_id, $group_id, $completion_data ) {
// Add your integration logic here.
},
10,
3
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
scorm_group_retake_started
Type: Action
Category: Webhook
Source: includes/utils/tracking.php:547
Status: Public
When It Runs
Fires when group retake started. The source call is inside scorm_player_reset_group_attempts(). Source context: Reset all course attempts inside a group and clear group tracking.
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. |
$selected_courses | $selected_courses | Additional context passed by the hook. |
Example
add_action(
'scorm_group_retake_started',
function ( $user_id, $group_id, $selected_courses ) {
// Add your integration logic here.
},
10,
3
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
scorm_player_course_status_transition
Type: Action
Category: Webhook
Source: includes/utils/tracking.php:285
Status: Public
When It Runs
Fires for course status transition. 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. |
$current_status | $current_status | 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_course_status_transition',
function ( $user_id, $scorm_id, $current_status, $new_status, $score ) {
// Add your integration logic here.
},
10,
5
);
Notes
- MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.
scorm_player_webhook_payload
Type: Filter
Category: Webhook
Source: includes/webhooks/webhook-functions.php:256
Status: Public
When It Runs
Filters webhook payload. The source call is inside scorm_player_webhooks_build_event_payload(). Source context: Build the common webhook event envelope.
Parameters
| Callback parameter | Source value | Notes |
|---|---|---|
$payload | $payload | Value passed through the filter. Source default: $payload. |
$event_type | $event_type | Additional context passed by the hook. |
$data | $data | Additional context passed by the hook. |
Return Value
Return the filtered $payload value. Source default: $payload. If you do not need to change it, return the original value unchanged.
Example
add_filter(
'scorm_player_webhook_payload',
function ( $payload, $event_type, $data ) {
return $payload;
},
10,
3
);
Notes
- Keep callbacks small and scoped to the source context shown above.