Check out the LimeSurvey source code on GitHub!

Automatic token generation when token is used

5 years 9 months ago #60617 by ryebank
Although this is partly a "can I do this" question I have posted under development because I know it will need some PHP tweaks.

I have a survey to capture results from a community questionnaire - this will go as a single printed copy to each household but individual household members will be allowed to enter further response sets online via LimeSurvey if they want. The printed copies will have unique numbers assigned to them to help us track response rates and even though they are delivered printed we will be encouraging people to do their return online. I will use the unique number as a token - but if say token 1234 is entered a second time on the token page I want to do a number of thing:
1. If token used but previous survey was not completed check if user want to complete now and if so show that partially completed response
2. If token used and fully completed or in above user opts to submit a new set of results then generate a new token based on the original one (e.g. 1234.1 or if that is also used 1234.2 etc.) and then enter the survey page with the new token

I have looked at the newtoken.php script from and I can see how I could deal with the token generation - but where do I need to "inject" this to get the token page to run this (modified as required) when LimeSurvey finds the token has been used rather than going to the normal "token used" page?

And any help about how to implement the redirections would be welcome too!

Thanks in advance

Please Log in to join the conversation.

5 years 9 months ago #60731 by ryebank
A real deathly hush in here ....

Anyway - I think I have figured where I need to start hacking - all the token checking seems to be in index.php and around line 640ish where the comment "//Check if TOKEN is used for EVERY PAGE" starts seems to be where I need to start my hack.

I'll keep this post updated in case this is of any use to anyone else in future

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form