configure the number of usesleft when public registration is enabled

More
2 years 1 month ago #124299 by jamarin
jamarin created the topic: configure the number of usesleft when public registration is enabled
Hello:
I need surveys with public registration (the users create their token entry) with several responses for user and response persistence (is long survey and I want that every page is saved, normally users forgot "save to later")

This can be done very easy if in settings would be possible to configure the number of usesleft (now always set usesleft=1) to adapt to the number of repetitions of the survey needed.
If I create the tokens table it is nor necessary this function because I import the number of usesleft. But for public registration there is no option (edit every entry is not possible due the amount of users that take the survey)

PS: Allow multiple responses doesn´t work because response persistence makes update responses instead of create a new one.

Please Log in to join the conversation.

More
2 years 1 month ago #124898 by DenisChenu
DenisChenu replied the topic: configure the number of usesleft when public registration is enabled
Hi,

In beforeTokenEmail : github.com/LimeSurvey/LimeSurvey/blob/ma...rController.php#L248

You have the token, then the token id. You can update this token to set Use left to anything else than 1.

Denis

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 .
The following user(s) said Thank You: jamarin

Please Log in to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #125980 by jamarin
jamarin replied the topic: configure the number of usesleft when public registration is enabled
Denis,
If I have understand properly you suggest to change the core code in my limesurvey platform (in the server side).
Going to the line 337 and insert a row with
$oToken->usesleft= 10;

Isn't it?

But if I have different number of uses left for different surveys. It has sense to have the possibility to set the number of uses when I fix the option of public registration (when someone activate the option he/she should have the possibility to select the number of uses -1 by default-)
Last Edit: 2 years 1 month ago by jamarin.

Please Log in to join the conversation.

More
2 years 1 month ago #125981 by DenisChenu
DenisChenu replied the topic: configure the number of usesleft when public registration is enabled

jamarin wrote: Denis,
If I have understand properly you suggest to change the core code in my limesurvey platform (in the server side).

No, i suggest to use beforeTokenEmail event to update the token with your usesleft.

You need to do a plugin : manual.limesurvey.org/Category:Plugins

You have to use :
- newSurveySettings to save the usesLeft by Survey
- manual.limesurvey.org/BeforeSurveySettings to show this to admin
- manual.limesurvey.org/BeforeTokenEmail to update the oToken

You find some example in plugins directory or in my git repo : git.framasoft.org/groups/SondagePro-LimeSurvey-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 .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now