I'm trying to get the profile picture of my users and display it in my liferay theme. So far I've been able to access the User object trough the velocity $user variable. The user model has a method called getPortraitUrl() which takes ThemeDisplay as a parameter. I've read in the liferay documentation that the themeDisplay object is available at runtime when working with themes, but I can't seem to make this work.

I've tried several different ways to get the themeDisplay object and none of them seem to work:

  • $theme
  • $themeDisplay
  • $request.get("theme-display")
  • $theme_display

... and several other methods that return nothing.

$user.getPortraitUrl($themeDisplay) is what I'm trying to achieve.

Any help would be greatly appreciated

有帮助吗?

解决方案

Be careful that the correct method is getPortraitURL(ThemeDisplay themeDisplay), URL is in uppercase.

Try this:

$user.getPortraitURL($themeDisplay)


You should also be able to use $themeDisplay.
Access Objects from Velocity is useful link for all liferay velocity variables.

其他提示

The variable you need to use for ThemeDisplay is

$theme_display

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top