Add new twig variable aSurveyInfo.owner_username

More
4 months 2 days ago #172116 by pfeigl
pfeigl created the topic: Add new twig variable aSurveyInfo.owner_username
Hello!

We need to have the owner username available in the templates. Which files should I look at to understand how data is set up for twig to render?

Thanks for any help with this!

Please Log in or Create an account to join the conversation.

More
4 months 2 days ago #172121 by LouisGac
LouisGac replied the topic: Add new twig variable aSurveyInfo.owner_username
so, first thing, in ls4 we'll provide real objects not the aSurveyInfo that is a remnant of previous LS versions. So you'll can have access in an ORM way to all the datas.


For now, I just added it:
github.com/LimeSurvey/LimeSurvey/commit/...7b5321a54093a7a891e9

It will be available in next release (beginning of next week). If you can't wait, just apply this commit to your installation.
Edit the file application/helpers/common_helper.php, find the function getSurveyInfo, and add the end of the definition of the array $thissurvey, add:
$thissurvey['owner_username'] = $result->survey->owner->users_name;
The following user(s) said Thank You: tpartner

Please Log in or Create an account to join the conversation.

More
4 months 2 days ago #172123 by pfeigl
pfeigl replied the topic: Add new twig variable aSurveyInfo.owner_username
Thanks for the quick info! Great news about ls4, looking forward to that!

I've tried this, but still don't see the data in twig. Is it possible that some additional filtering is going on somewhere?

Please Log in or Create an account to join the conversation.

More
4 months 2 days ago #172126 by LouisGac
LouisGac replied the topic: Add new twig variable aSurveyInfo.owner_username
I've just tested it again, the owner user name is available via:
{{ aSurveyInfo.owner_username }}

Please Log in or Create an account to join the conversation.

More
4 months 2 days ago #172131 by dominikvitt
dominikvitt replied the topic: Add new twig variable aSurveyInfo.owner_username
You should delete twig cache in /LimeSurvey/tmp/runtime/twig_cache

Please Log in or Create an account to join the conversation.

More
4 months 2 days ago #172135 by pfeigl
pfeigl replied the topic: Add new twig variable aSurveyInfo.owner_username
Thanks, LouisGac that's exactly what I'm using, and I've also deleted that cache, but still no luck. I've added the patch to latest release, not current git, maybe that is the problem. I'll see whether I can update our instance to current git, or maybe just wait for the next release for a few days.

Please Log in or Create an account to join the conversation.

More
4 months 1 day ago #172159 by LouisGac
LouisGac replied the topic: Add new twig variable aSurveyInfo.owner_username
I will post you a patch to apply to latest release today.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!