Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

The variable you need to use for ThemeDisplay is

$theme_display

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top