Open applications\quizzes\sources\Quiz\Quiz.php and find:
/**
* Save the Quiz (Leaderboard)
*/
public function saveGame( $score, $time )
{
/* Save the Quiz results in the Leaderboard. Only the first attempt will be recorded */
if( \IPS\Db::i()->select( 'COUNT(*) as count', 'quizzes_leaders', array( 'q_lquiz_id=? AND q_lmid=?', $this->id, \IPS\Member::loggedIn()->member_id ) )->first() == 0 )
{
$toInsert = array(
'q_lquiz_id' => $this->id,
'q_lmid' => \IPS\Member::loggedIn()->member_id,
'q_lscore' => $score,
'q_ldate' => time(),
'q_lipaddress' => \IPS\Request::i()->ipAddress(),
'q_ltime' => $time
);
\IPS\Db::i()->insert( 'quizzes_leaders', $toInsert, TRUE );
}
}
Change to:
/**
* Save the Quiz (Leaderboard)
*/
public function saveGame( $score, $time )
{
/* Save the Quiz results in the Leaderboard. Only the first attempt will be recorded */
if( \IPS\Db::i()->select( 'COUNT(*) as count', 'quizzes_leaders', array( 'q_lquiz_id=? AND q_lmid=?', $this->id, \IPS\Member::loggedIn()->member_id ) )->first() == 0 )
{
$toInsert = array(
'q_lquiz_id' => $this->id,
'q_lmid' => \IPS\Member::loggedIn()->member_id,
'q_lscore' => $score,
'q_ldate' => time(),
'q_lipaddress' => \IPS\Request::i()->ipAddress(),
'q_ltime' => $time
);
\IPS\Db::i()->insert( 'quizzes_leaders', $toInsert, TRUE );
}
else
{
$toUpdate = array(
'q_lscore' => $score,
'q_ldate' => time(),
'q_lipaddress' => \IPS\Request::i()->ipAddress(),
'q_ltime' => $time
);
\IPS\Db::i()->update( 'quizzes_leaders', $toUpdate, array( 'q_lquiz_id=? AND q_lmid=?', $this->id, \IPS\Member::loggedIn()->member_id ) );
}
}
This will add a new record if the user hasn't played yet and will update that record if already played.
I probably will add it as a setting in the next version.