Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Change 'Valid Until" date for all Tokens of an active survey

  • Effenberg0x0
  • Effenberg0x0's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 weeks ago #149573 by Effenberg0x0
Hi,

I had to extend the expiry date of a survey (in survey settings). However, users still see the survey expired message when they try to access using the the tokens they got via email, because each token "Valid Until" date would have to be adjusted (all are expired).

It's more than 5,000 tokens... Editing one by one would take a lifetime.

Is there any way I can fix this?

Thanks!
Effenberg
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 weeks ago #149576 by tpartner
You can export the token table, edit the CSV file and re-import the tokens. Make sure you have a complete back-up first and edit the file with a decent tool like LibreOffice Calc.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
7 years 3 weeks ago - 7 years 3 weeks ago #149577 by Ben_V
... or use a SQL query if you can access the database:
Code:
UPDATE `lime_tokens_12345` SET `validuntil`= "2020-01-01 00:00:00"
Where "12345" is your survey ID

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 3 weeks ago by Ben_V.
The topic has been locked.
  • Effenberg0x0
  • Effenberg0x0's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 weeks ago #149578 by Effenberg0x0
Export Tokens CSV / Edit / Import CSV:
Limesurvey won't update existing tokens if I import the edited CSV. The procedure would have to be:
- Export tokens CSV;
- Delete tokens table. Limesurvey says the survey will not require tokens for access from now on;
- Edit CSV;
- Create new empty tokens table;
- Import edited CSV;
- Check whether settings to require tokens for access persisted;
- Pray things still work and tokens are still associated to existing complete/partial responses.
I am not a particularly lucky person, I think it would probably destroy the survey beyond repair if I proceeded, so I did not.


SQL Query:
Worked like a charm!

Thank you guys!

Regards,
Effenberg
The topic has been locked.
More
7 years 3 weeks ago #149583 by jelo

Effenberg0x0 wrote: Export Tokens CSV / Edit / Import CSV:
Limesurvey won't update existing tokens if I import the edited CSV.

That sounds like a feature request. But even if replacement would be possible, we need
a) a maintenance screen or/and
b) a selection column replacement

During exporting and modifying the CSV-tokenlist the survey goes on. What if something has changed during that timespan (e.g. Usages left changed)?
The importmode should be allowing replacement, partial replacement and appending.

Feature request is here:
bugs.limesurvey.org/view.php?id=12167

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: Ben_V
The topic has been locked.
  • Effenberg0x0
  • Effenberg0x0's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 weeks ago #149586 by Effenberg0x0
I completely agree with you Jelo. Thank you very much for creating the feature request.

Regards,
Effenberg
The topic has been locked.
More
7 years 3 weeks ago #149621 by Ben_V
Waiting for some enhancements, following SQL queries/syntaxes remain useful for users needing to update their [lime]_tokens[12345] table...
Code:
UPDATE `lime_tokens_12345` SET `usesleft` = '999'  
UPDATE `lime_tokens_12345` SET `usesleft` = '999' WHERE `tid` < 10
 
UPDATE `lime_tokens_12345` SET `validfrom`= "2017-01-01 00:00:00"
UPDATE `lime_tokens_12345` SET `validfrom`= "2017-01-01 00:00:00" WHERE `tid` < 10
 
UPDATE `lime_tokens_12345` SET `validuntil`= "2020-01-01 00:00:00"
UPDATE `lime_tokens_12345` SET `validuntil`= "2020-01-01 00:00:00" WHERE `tid` < 10
 
UPDATE `lime_tokens_12345` SET `completed`= "Y"
UPDATE `lime_tokens_12345` SET `completed`= "Y" WHERE `tid` < 10

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose