- Posts: 3
- Thank you received: 0
- Community
- Forums
- English support forums
- Development
- Add new twig variable aSurveyInfo.owner_username
Add new twig variable aSurveyInfo.owner_username
6 months 1 week ago #172116
by pfeigl
Add new twig variable aSurveyInfo.owner_username was created by pfeigl
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!
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.
6 months 1 week ago #172121
by LouisGac
Replied by LouisGac on 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:
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.
6 months 1 week ago #172123
by pfeigl
Replied by pfeigl on 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?
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.
6 months 1 week ago #172126
by LouisGac
Replied by LouisGac on 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.
- dominikvitt
-
- Offline
- Administrator Lime
-
Less
More
- Posts: 5
- Thank you received: 2
6 months 1 week ago #172131
by dominikvitt
Replied by dominikvitt on 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.
6 months 1 week ago #172135
by pfeigl
Replied by pfeigl on 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.
6 months 1 week ago #172159
by LouisGac
Replied by LouisGac on 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.