- Posts: 1
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Generating token attribute values on new public registrations
- rohitparker
- Topic Author
- Offline
- New Member
Less
More
5 years 6 months ago #175181
by rohitparker
VidMate AnyDesk mobdro.onl/
Generating token attribute values on new public registrations was created by rohitparker
Hi all,
We have a project that involves a known list of potential project participants, with email addresses, and so a token-based survey is a good solution. The token table will have one additional attribute (attribute_1) - an external study ID - which will be pre-populated for the known set of participants. The external study IDs are of the form CS-0000001, CS-0000002, CS-0000003, and so on.
We would also like to have the option for public registration, so that additional people can participate. Limesurvey's "allow public registration" option will insert a token into the token table for these new registrants, but we would also like to insert a new external study ID into attribute_1 when the new token is created. The external study ID must be unique, and can simply be an increment of the last attribute value in the token table. The new registrant should not need to input the study ID him/herself at the time of registration.
Does anyone know if this is possible in Limesurvey? This capability will greatly simplify our project and remove the need for two different streams of data handling (those known up-front, and those participating via a wider registration approach).
Any advice would be greatly appreciated!
Thanks,
We have a project that involves a known list of potential project participants, with email addresses, and so a token-based survey is a good solution. The token table will have one additional attribute (attribute_1) - an external study ID - which will be pre-populated for the known set of participants. The external study IDs are of the form CS-0000001, CS-0000002, CS-0000003, and so on.
We would also like to have the option for public registration, so that additional people can participate. Limesurvey's "allow public registration" option will insert a token into the token table for these new registrants, but we would also like to insert a new external study ID into attribute_1 when the new token is created. The external study ID must be unique, and can simply be an increment of the last attribute value in the token table. The new registrant should not need to input the study ID him/herself at the time of registration.
Does anyone know if this is possible in Limesurvey? This capability will greatly simplify our project and remove the need for two different streams of data handling (those known up-front, and those participating via a wider registration approach).
Any advice would be greatly appreciated!
Thanks,
VidMate AnyDesk mobdro.onl/
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
5 years 6 months ago #175183
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Generating token attribute values on new public registrations
As far as I know, not within LimeSurvey alone.
With a little programming, you should be able to create your own PHP "registration" page that:
- Queries the database for the last attribute_1 value
- Increments that value
- Creates a new token via API
- Redirects the user to the survey
Here is a post that may give inspiration for the latter part of that - www.limesurvey.org/forum/can-i-do-this-w...-fly?start=15#158184
With a little programming, you should be able to create your own PHP "registration" page that:
- Queries the database for the last attribute_1 value
- Increments that value
- Creates a new token via API
- Redirects the user to the survey
Here is a post that may give inspiration for the latter part of that - www.limesurvey.org/forum/can-i-do-this-w...-fly?start=15#158184
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 6 months ago - 5 years 6 months ago #175188
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Generating token attribute values on new public registrations
Alternative solution using API
1st : Use beforeRegister event gitlab.com/SondagesPro/SurveyAccess/registerQuick
2nd : maybe better : in beforeSurveyPage event,
- 1 : get the current token
- 2 : load the token from DB ($oToken)
- 3 test if attribute is set
- 4 if not set : set it and save $oToken
Here : you can se token management in a plugin gitlab.com/SondagesPro/managament/respon...tAndManage.php#L2084
1st : Use beforeRegister event gitlab.com/SondagesPro/SurveyAccess/registerQuick
2nd : maybe better : in beforeSurveyPage event,
- 1 : get the current token
- 2 : load the token from DB ($oToken)
- 3 test if attribute is set
- 4 if not set : set it and save $oToken
Here : you can se token management in a plugin gitlab.com/SondagesPro/managament/respon...tAndManage.php#L2084
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 6 months ago by DenisChenu.
The topic has been locked.