Skip to content

Instantly share code, notes, and snippets.

@woogist
Last active August 29, 2015 14:22
Show Gist options
  • Save woogist/27f2ae7233b6cb7e3ab5 to your computer and use it in GitHub Desktop.
Save woogist/27f2ae7233b6cb7e3ab5 to your computer and use it in GitHub Desktop.
Using sensei_user_quiz_status to change the quiz info box message ( text, css class and status )
// register the action filter
add_filter('sensei_user_quiz_status', 'custom_sensei_quiz_status', 20 , 3 );
/**
* Custom function that hooks into sensei_user_quiz_status
*
* @param array $status_data{
* type string $status
* type string $box_class
* type string $message
* type string $extra
* }
* @param int $lesson_id
* @param int $user_id
*
* @return array $status_data
*/
function custom_sensei_quiz_status( $status_data, $lesson_id , $user_id ){
//change the $status_data message
$status_data['message'] = "New Custom Status message";
//change the $status_data box class
// Sensei Defaults: info, tick, alert
$status_data['box_class'] = "tick"; // you may change this if you want a custom icon
//change the status
// Sensei Defaults: not_started_course, login_required, passed ,complete, failed, not_started
$status_data['status'] = "failed";
//return the full status array
return $status_data;
}// end custom_sensei_quiz_status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment