Hi anamostafa,
Thank you for your response and the additional details!
Upon reviewing the issue, it appears that the hook learn-press/user-course-finished
passes three parameters, but your implementation is only accepting two parameters, which could cause the critical error.
To resolve this, please update your hook implementation to accept all three parameters:
$course_id
: The ID of the completed course.
$user_id
: The ID of the user who completed the course.
$return
: The completion status of the course.
Here’s the corrected code:
add_action('learn-press/user-course-finished', 'my_custom_function', 10, 3); // Note: The third parameter is now added.
function my_custom_function($course_id, $user_id, $return) {
// do something
}
This should handle all the parameters passed by the hook and prevent the critical error.
If you still encounter issues, please double-check that the function is correctly defined and the file doesn’t contain other syntax errors. Let us know if you need further assistance!
Best regards,
Brianvu-tp