Hi @hazirahs
I need to discuss this with my development team. Hopefully, I will get back to you with the solution.
Regards,
Sumit
Hi @hazirahs ,
You can use below-given action hook which you can use to create a cookie after submitting a quiz.
function add_submit_record( $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables ) {
//Your Code
}
add_action(‘qsm_quiz_submitted’, ‘add_submit_record’, 30, 4);
Let me know if you need more help.
Regards,
Sumit
Hi @sumitsanadhya,
I’ve tried for days and still was not able to setup the cookie. Sorry my knowledge on this is rather bad… Can you please check where I went wrong?
function add_submit_record( $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables ) {
//Your Code
$cookie_name = ‘qsm_submit’;
$cookie_value = $results_id;
setcookie($cookie_name, $cookie_value, time() + (86400 * 14), ‘/’);
}
add_action(‘qsm_quiz_submitted’, ‘add_submit_record’, 30, 4);
Thank you
Hi @hazirahs
It seems that there is some issue with the inverted comma. I request you to please check below-given code.
function add_submit_record( $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables ) {
//Your Code
$cookie_name = 'qsm_submit';
$cookie_value = $results_id;
setcookie($cookie_name, $cookie_value, time() + (86400 * 14), '/');
}
add_action('qsm_quiz_submitted', 'add_submit_record', 99, 4);
Regards,
Sumit