Foros de discusión

How to get user/owner of a page in vm?

Oliver Bayer, modificado hace 14 años.

How to get user/owner of a page in vm?

Liferay Master Mensajes: 894 Fecha de incorporación: 18/02/09 Mensajes recientes
Hi,

in my theme I want to get the owner (the user object) of a page in portal-normal.vm to show the user name in the page title. But I don't know by which method and by which parameter I can achieve this: plid, friendlyurl, groupid?

Any hints are appreciated.

Oli
Vin k k, modificado hace 14 años.

RE: How to get user/owner of a page in vm?

Regular Member Mensajes: 138 Fecha de incorporación: 4/12/07 Mensajes recientes
Hi,

Have you tried this,look themes\_unstyled\templates\init.vm, you will get idea.

#set ($user_id = $user.getUserId())
#set ($is_default_user = $user.isDefaultUser())
#set ($user_first_name = $user.getFirstName())
#set ($user_middle_name = $user.getMiddleName())
#set ($user_last_name = $user.getLastName())
#set ($user_name = $user.getFullName())
#set ($is_male = $user.isMale())
#set ($is_female = $user.isFemale())
#set ($user_birthday = $user.getBirthday())
#set ($user_email_address = $user.getEmailAddress())
#set ($language_id = $user.getLanguageId())
#set ($time_zone = $user.getTimeZoneId())
#set ($user_greeting = $htmlUtil.escape($user.getGreeting()))
#set ($user_comments = $user.getComments())
#set ($user_login_ip = $user.getLoginIP())
#set ($user_last_login_ip = $user.getLastLoginIP())
#set ($user_group = $user.getGroup())
#set ($user_organizations = $user.getOrganizations())

Ciao
Vin kk
Oliver Bayer, modificado hace 14 años.

RE: How to get user/owner of a page in vm?

Liferay Master Mensajes: 894 Fecha de incorporación: 18/02/09 Mensajes recientes
Hey Vin,

thanks for answering.
To say it more precisely: I don't want to get the actual logged in user but the owner of the page the actual user is at atm (if it's a user page and not a community). I need the owner name to print it to the title-tag of the page.

Oli
Mazhar Anwar, modificado hace 14 años.

RE: How to get user/owner of a page in vm?

Regular Member Mensajes: 125 Fecha de incorporación: 5/02/10 Mensajes recientes
Oliver Bayer:
Hey Vin,

thanks for answering.
To say it more precisely: I don't want to get the actual logged in user but the owner of the page the actual user is at atm (if it's a user page and not a community). I need the owner name to print it to the title-tag of the page.

Oli


You can get creator user Id with "$layout.getGroup().getCreatorUserId()".

Further if you want you can get user object with above userId.

Regards,
Mazhar
Oliver Bayer, modificado hace 14 años.

RE: How to get user/owner of a page in vm?

Liferay Master Mensajes: 894 Fecha de incorporación: 18/02/09 Mensajes recientes
Hi Mazhar,

cool, this could be the solution. Thanks!

But I don't know why this code-snippet works emoticon.
As far as I understand this method it returns the creator of the page NOT the owner. But it seems to work for userpages although the users don't create the pages by themself but get them created via group membership.

Greets Oli