Can I pass user token into url after registration?

More
9 months 5 days ago #147105 by InfoSolutionsProvider
InfoSolutionsProvider created the topic: Can I pass user token into url after registration?
Hello,

I want users to be able to click a link to immediately proceed with the survey after registering, without waiting for the confirmation email or leaving their browser. (The email still gets sent with the link, but my users are fairly impatient and the need has arisen to apply this workaround).

Following the instructions in the manual gets all the url parameters to work fine, except the unique token created when the user registered. I've tried many combinations, but the token returns blank, even when I can confirm that it's created in the database.

$publicurl/index.php?lang=en&sid={SID}&token={TOKEN}/newtest/Y

$publicurl/index.php/{SID}/lang/en/token/{TOKEN:TOKEN}/newtest/Y

$publicurl/index.php/{SID}/lang/en/token/{TOKEN}

$publicurl/index.php/{SID}/lang/en/token/{token}

I'm sure I'm missing something fairly simple, but can't for the life of me figure it out.

Thanks very much for your help.

Please Log in to join the conversation.

More
9 months 2 days ago #147154 by fvanderstarre
fvanderstarre replied the topic: Can I pass user token into url after registration?
You might have a go with "{SURVEYURL}" (in case you haven't tried yet)?
It might well be that the TOKEN session variable is not set at registration time, e.g. for security reasons or because it will be sent by email anyway.
Good luck! Frank
The following user(s) said Thank You: InfoSolutionsProvider

Please Log in to join the conversation.

More
9 months 2 days ago #147156 by InfoSolutionsProvider
InfoSolutionsProvider replied the topic: Can I pass user token into url after registration?
Thanks Frank. I already tried {SURVEYURL} but no joy. Probably because of your explanations.
In the end I had to change to an open survey without registration.

Please Log in to join the conversation.

More
9 months 1 day ago - 9 months 1 day ago #147211 by tpartner
tpartner replied the topic: Can I pass user token into url after registration?

In the end I had to change to an open survey without registration.

If you need immediate access after "registration", here are two possible workarounds:

1) Place mandatory email and name questions in the first survey group.

2) Create you own registration form and use the RemoteControl 2 API to create the token and redirect to the survey.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 9 months 1 day ago by tpartner.
The following user(s) said Thank You: InfoSolutionsProvider

Please Log in to join the conversation.

More
9 months 1 day ago #147268 by InfoSolutionsProvider
InfoSolutionsProvider replied the topic: Can I pass user token into url after registration?
Thanks Tony.

As it happens, your suggested option 1 is what I ended up doing, having done away with the built in registration facility by making it an open survey.

I quite like the idea of the remote control API, and will tackle it on another project when I have a bit more time to get my head round it.

Best.

Fatai

Please Log in to join the conversation.

More
9 months 21 hours ago #147285 by DenisChenu
DenisChenu replied the topic: Can I pass user token into url after registration?
Thnik best is to create a plugin for this.

Using some event in github.com/LimeSurvey/LimeSurvey/blob/ma...gisterController.php

Or take insipration of this old code framagit.org/SondagePro-LimeSurvey-plugin/replaceRegister

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.

More
2 months 12 hours ago #157727 by Pandar
Pandar replied the topic: Can I pass user token into url after registration?
Hey! I've done this. I editted this file:
application/controllers/RegisterControllers.php
• Go to the public function getTokenId($iSurveyId).
• At the end of this function is a line where $sMailMessage can be replaced.

$this->sMailMessage= "<div id='wrapper' class='message tokenmessage'>"
. "<p>".gT("Thank you for registering to participate in this ballot.")."</p>\n"
. "<p>".gT("An email has been sent to the address you provided with an access link to this ballot.")."</p>\n"

//You can either replace, add or comment out what you don't need, but this is where you would insert something like this:

. "<p>".gT("Click Here to Proceed:")."<a href=' www.yoururl.com/index.php/12345/lang/en/token/$oToken- >token'>"."Access Survey Here."."</a></p>"
. "<p>".sprintf(gT("Survey administrator %s (%s)"),$aSurveyInfo,$aSurveyInfo)."</p>"
. "</div>\n";


return $oToken->tid;

}
}

The $oToken->tid was the clue. I set the message to display this and it showed me the ID from the database. Then I realized $oToken is an object. All I had to do was find the variable containing the token values. Scrolling up, I found $oToken->token and gave that a try. I think this will only work within this php file though.

Is this what you were looking for? PS. if this works for you after you edit your files, be sure to run backups in case your updates are automatic.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now