I've modified quiz_play_once_addition code to quiz.php as the additional AFTER, ADD below:
FIND
Code: Select all
if( is_numeric($qpo_user_plays[$exp]) && $qpo_user_plays[$exp] == $userdata['user_id'] )
{
Code: Select all
if( quiz_check_moderative_status($userdata['user_id'], $quiz_id) == ON )
{
$message_ctl = sprintf($lang['Quiz_author_cannot_play_give_edit_options'], '<a href="' . append_sid("quiz_cp.$phpEx?mode=edit&q=$quiz_id") . '">', '</a>', '<a href="' . append_sid("quiz_cp.$phpEx?mode=delete&q=$quiz_id") . '">', '</a>', '<a href="' . append_sid("quiz_cp.$phpEx?mode=move&q=$quiz_id") . '">', '</a>');
}
Anyhow, to save confusion, here's the modified code. Slightly messy but it works.
Code: Select all
// 06-11-08 quiz_play_once_addition
$message = 'You have already attempted to play this Quiz' . '<br /><br />' . sprintf($lang['Quiz_click_return_quiz'], '<a href="' . append_sid("quiz.$phpEx") . '">', '</a>');
if( quiz_check_moderative_status($userdata['user_id'], $quiz_id) == ON )
{
$message_ctl = '<br /><br />' . sprintf($lang['Quiz_author_cannot_play_give_edit_options'], '<a href="' . append_sid("quiz_cp.$phpEx?mode=edit&q=$quiz_id") . '">', '</a>', '<a href="' . append_sid("quiz_cp.$phpEx?mode=delete&q=$quiz_id") . '">', '</a>', '<a href="' . append_sid("quiz_cp.$phpEx?mode=move&q=$quiz_id") . '">', '</a>');
}
$qpo_sql = $db->sql_query("SELECT quiz_user_list FROM " . QUIZ_GENERAL_TABLE . " WHERE quiz_id = $quiz_id");
$qpo_row = $db->sql_fetchrow($qpo_sql);
$qpo_user_plays = explode(',', $qpo_row['quiz_user_list']);
for( $exp = 0; $exp < count($qpo_user_plays); $exp++ )
{
if( is_numeric($qpo_user_plays[$exp]) && $qpo_user_plays[$exp] == $userdata['user_id'] )
{
message_die(GENERAL_MESSAGE, $message . $message_ctl);
}
}
$qpo_addition_list = $qpo_row['quiz_user_list'] . ',' . $userdata['user_id'];
$db->sql_query("UPDATE " . QUIZ_GENERAL_TABLE . " SET quiz_user_list = '" . $qpo_addition_list . "' WHERE quiz_id = $quiz_id");
// -- end qpo addition
Also, in an ideal situation, the You have already attempted to play this Quiz shouldn't be true if it's a quiz created by the quiz author as on first "play" the You cannot play quizzes which you have submitted! is correctly displayed (along with moderator controls). Of course, thereafter, the quiz_user_list gets updated meaning that subsequent selection of a Quiz created by the Quiz Author results in You have already attempted to play this Quiz (again, with Moderator controls).
Like I've said elsewhere, I'm not an expert on php and still getting to grips with it so forgive me if it's not quite the right way to do what I've done.