Liferay 7.3 FreeMarker display username using Web Content template

thumbnail
Nick Burton, modified 5 Years ago. Junior Member Posts: 51 Join Date: 7/13/14 Recent Posts
Version:  Liferay 7.3
How do I get Freemarker to display the user's (first) name within Web Content using a custom template?
Use Case:  <p>Welcome, ${userName}.</p>
thumbnail
Mohammed Yasin, modified 5 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi , You can try below code
.vars['reserved-article-author-name'].data
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
That's the name of the author, not the name of the current user.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
${user.getFirstName()}  should work.
thumbnail
Nick Burton, modified 5 Years ago. Junior Member Posts: 51 Join Date: 7/13/14 Recent Posts
Thank you very much.${user.getFirstName()}  worked perfectly.
When I search for Liferay 7.3 variables I get different versions of them.  Is there a page that has the current list of variable options?
Thanks again.
Lee Jordan, modified 5 Years ago. Expert Posts: 449 Join Date: 5/26/15 Recent Posts
There is this for the theme but for templates the documentation is lacking ...https://help.liferay.com/hc/en-us/articles/360032627372-Freemarker-Variable-Reference-Guide
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Maybe James' Magic Template Dumper helps - it might need some adaptation for the latest version, but the approach might still work. And then, the information would come from the currently running system, e.g. be accurate and up to date.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I have used this fork recently and it works at least with 7.3.2:
https://gist.github.com/bmvakili/b5d871b4cbc4ebbbe0a0
I think, some issues with the old code were fixed there.
thumbnail
Nick Burton, modified 5 Years ago. Junior Member Posts: 51 Join Date: 7/13/14 Recent Posts
Thanks, everyone.
thumbnail
Nick Burton, modified 5 Years ago. Junior Member Posts: 51 Join Date: 7/13/14 Recent Posts
Just a thought ... This sort of script would be useful to have as a built-in feature.  Perhaps a default admin page that can be visited on every virtual instance.