Reputation: 13
How to display user greeting (the once which is defined in vm file) in liferay web content portlet.
Upvotes: 1
Views: 2428
Reputation: 3865
Which vm file?
Nevertheless you can have in your velocity template for your article
#set($us = $serviceLocator.findService("com.liferay.portal.service.UserLocalService"))
#set($userId = $getterUtil.getLong($request.get("theme-display").get("user-id")))
$htmlUtil.escape($us.getUserById($userId).getGreeting())
for liferay 6+
For previouse versions change first line to
#set($us = $serviceLocator.findService("com.liferay.portal.service.UserLocalServiceUtil"))
For this to work you heve to have
journal.template.velocity.restricted.variables=
in your portal-ext.properties file. To be more correct serviceLocator must not be stated in
journal.template.velocity.restricted.variables=
Default for this property is
journal.template.velocity.restricted.variables=serviceLocator
Upvotes: 1