I'm trying to programmatically populate a modal with the quiz statistics form for a given quiz attempt (the one that shows on the quiz attempt statistics modal) and I was under the impression that I could use the
WpProQuiz_Controller_Statistics();
Along with ajaxLoadStatisticUser($user_data, '');
Where user_data was the statistics_ref ID, the userID of the student and a nonce (created as you can see below).
But all I get in the response is CSS code.
Can any developers who are familiar with LearnDash point me in the right direction?
if ($ref_id && $user_id) {
$statisticController = new WpProQuiz_Controller_Statistics();
$user_data = array(
'refId' => $ref_id,
'userId' => $user_id,
'statistic_nonce' => esc_attr(wp_create_nonce('statistic_nonce_' . $ref_id . '_' . get_current_user_id() . '_' . $user_id))
);
$result = $statisticController->ajaxLoadStatisticUser($user_data, '');
error_log(print_r($result, true));
echo $statisticController->ajaxLoadStatisticUser($user_data, '');
} else {
echo 'Invalid ID or User not logged in.';
}
wp_die();
}