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
  • pfeigl's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172116 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!
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 7 months ago #172121 by LouisGac
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:
Code:
$thissurvey['owner_username'] = $result->survey->owner->users_name;
The topic has been locked.
  • pfeigl
  • pfeigl's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172123 by pfeigl
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?
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 7 months ago #172126 by LouisGac
I've just tested it again, the owner user name is available via:
Code:
{{ aSurveyInfo.owner_username }}
The topic has been locked.
  • dominikvitt
  • dominikvitt's Avatar
  • Visitor
  • 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
  • pfeigl's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172135 by pfeigl
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
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 7 months ago #172159 by LouisGac
I will post you a patch to apply to latest release today.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose