- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Add new twig variable aSurveyInfo.owner_username
- pfeigl
- Topic Author
- Offline
- New Member
Less
More
5 years 7 months 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!
The topic has been locked.
- LouisGac
- Visitor
5 years 7 months 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:
Code:
$thissurvey['owner_username'] = $result->survey->owner->users_name;
The topic has been locked.
- pfeigl
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
5 years 7 months 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?
The topic has been locked.
- LouisGac
- Visitor
5 years 7 months 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:
Code:
{{ aSurveyInfo.owner_username }}
The topic has been locked.
- dominikvitt
- Visitor
5 years 7 months 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
The topic has been locked.
- pfeigl
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
5 years 7 months 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.
The topic has been locked.
- LouisGac
- Visitor
5 years 7 months 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.
The topic has been locked.