Restarting timer if survey taken on the same computer

Mehr
1 Jahr 7 Monate her #151293 von Arthemis
Arthemis erstellte das Thema Restarting timer if survey taken on the same computer
Hello everyone.
I have a survey with multiple questions that have a time limit. To prevent respondents returning to the same incomplete survey on the same computer, I used the newtest=Y in the URL. It does restart the survey but the timed questions appear out of time if the time elapsed on the previous attempt to answer the survey. How do I change this to have a completely new start without manually erasing cookies?
Thank you in advance!

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 7 Monate her #151308 von DenisChenu
DenisChenu antwortete auf das Thema: Restarting timer if survey taken on the same computer
Not included currently in LimeSurvey core .

Timer are in cookies
Solution : make a plugin to reset timer cookies with beforeSurveyPage

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 7 Monate her - 1 Jahr 7 Monate her #151324 von Arthemis
Arthemis antwortete auf das Thema: Restarting timer if survey taken on the same computer
Thank you for your reply. Is it something I can change myself using the controls of the survey (and if yes - how) or is it in the setup of the LimeSurvey installation (I don't have access to this unfortunately, I'm using the survey through an organization that installed it for its researchers).
Letzte Änderung: 1 Jahr 7 Monate her von Arthemis.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 7 Monate her #151325 von DenisChenu
DenisChenu antwortete auf das Thema: Restarting timer if survey taken on the same computer

DenisChenu schrieb: Not included currently in LimeSurvey core .
....


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 7 Monate her #151327 von Arthemis
Arthemis antwortete auf das Thema: Restarting timer if survey taken on the same computer
Thank you. Here the plugin I wrote:
<?php
/**
* resetTimersNM Plugin for LimeSurvey
* Reset the timers for each question in a survey.
*
*
*
*/

class resetTimersNM extends \ls\pluginmanager\PluginBase {
static protected $description = 'Reset questions timers';
static protected $name = 'resetTimersNM';

public function init() {
$this->subscribe('beforeSurveyPage');
}

public function beforeSurveyPage() {
$oEvent = $this->event;
$iSurveyId=$oEvent->get('surveyId');

if (isset($_COOKIE)) {
unset($_COOKIE);
setcookie('limesurvey_timers', '', time() - 3600, '/'); // empty value and old timestamp
}

}
}

It works. Now I want to restart the timer only for new users on the same computer where a previous user did not submit. That is, I want to prevent users from reloading the page to get more time to answer the timed question. I identify unique users by login=uniquelogin in the URL where login is a hidden short-text question. Is there another event that is triggered by the start of the survey?
Thank you!

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 7 Monate her #151334 von Arthemis
Arthemis antwortete auf das Thema: Restarting timer if survey taken on the same computer
Ok, I figured it out. The plugin below resets timers only for those who just loaded the survey and passed the first question (i.e., the new comer, not someone trying to reload the page to get more time). It's also written to be survey-specific (in this case surveyID=9999) and the question id is set to 2 but can be any question at the start of the survey:
<?php
/**
* resetTimersNM Plugin for LimeSurvey
* Reset the timers for each question in a survey.
*
*
*
*/

class resetTimersNM extends \ls\pluginmanager\PluginBase {

static protected $description = 'Reset questions timers';
static protected $name = 'resetTimersNM';

public function init() {
$this->subscribe('beforeQuestionRender');
}

public function beforeQuestionRender() {

// Get Event
$oEvent = $this->event;

// Fetch Parameters
$iSurveyId = $oEvent->get('surveyId');
$qid = $oEvent->get('qid');

// Reset timers cookie for a specific survey and when the user go through
// a specific question.
if($iSurveyId==9999 && $qid==2)
{
if (isset($_COOKIE)) {
unset($_COOKIE);
setcookie('limesurvey_timers', '', time() - 3600, '/'); // empty value and old timestamp
}
}

}


}
Folgende Benutzer bedankten sich: DenisChenu

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 7 Monate her #151823 von DenisChenu
DenisChenu antwortete auf das Thema: Restarting timer if survey taken on the same computer
:cheer: Seems great start for a new plugin !

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 1 Woche her #169491 von mhm1704
mhm1704 antwortete auf das Thema: Restarting timer if survey taken on the same computer
Do you know if there is a plug in to reset timer with beforeSurveyPage;

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha