Welcome to the LimeSurvey Community Forum

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

Getting Token Value in Plugin

  • sodiumchl
  • sodiumchl's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 6 months ago - 3 years 6 months ago #217388 by sodiumchl
Getting Token Value in Plugin was created by sodiumchl
I'm trying to get the value of TOKEN:COMPLETED in a plugin. For some response, the following code gives me '2021-06-04 12:49' where as {TOKEN:COMPLETED} in an equation question gives me 'N'. (In the Responses table I also see No for Completed.) Why? How can I get the same result in php as in an equation question?
Code:
[code]$aReplacement=array('QID'=>$qid, 'GID'=>$gid, 'SGQ'=>$qCode);
$tComp = strip_tags(LimeExpressionManager:ProcessStepString('{TOKEN:COMPLETED}',$aReplacement,3,1));
(LS version 3.x.x)
Last edit: 3 years 6 months ago by sodiumchl.
The topic has been locked.
More
3 years 6 months ago #217508 by bismark
Replied by bismark on topic Getting Token Value in Plugin
maybe `LimeExpressionManager::loadTokenInformation($sid, $token)`?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 6 months ago #217515 by DenisChenu
Replied by DenisChenu on topic Getting Token Value in Plugin
All token column name can be used (except participant_id because the are a _ in it) in TOKEN:
github.com/LimeSurvey/LimeSurvey/blob/d0...ger_helper.php#L3950

The question more : when you use this function ? In survey : it must work, elsewhere : must "load" survey before.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • sodiumchl
  • sodiumchl's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 5 months ago #217809 by sodiumchl
Replied by sodiumchl on topic Getting Token Value in Plugin
> The question more : when you use this function?
I am using it in beforeQuestionRender().

When I try LimeExpressionManager::loadTokenInformation($sid, $token), I get an error: $this undefined.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 5 months ago #217857 by DenisChenu
Replied by DenisChenu on topic Getting Token Value in Plugin
No idea …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose