Jahia in English > How to access the...

0 (0 Good)
0 (0 Bad)

How to access the properties of currently logged-in user?

by  namitgupta »  2012/10/15 11:37

Hi,

I am trying to access the properties of the currently logged-in user (firstname,lastname,email etc) using the following code snippet:

${currentUser.userProperties.properties.firstname}
${currentUser.userProperties.properties.lastname}
${currentUser.userProperties.properties.email}

However, i am not able to retrieve the values from the JCR.

Can i retrieve these values using some Java API's provided by Jahia? 

Please share your thoughts on this.

 

Regards,

Namit Gupta

  (namitgupta)

Number of messages  36
Registration date
0 (0 Good)
0 (0 Bad)

Re: How to access the properties of currently logged-in user?

by  shyrkov »  2012/10/22 21:23

Hello Namit,

you can achive it by using:

${renderContext.user.properties[j:firstName]}

${renderContext.user.properties[j:lastName]}

${renderContext.user.properties[j:email]}

If you are using Jahia 6.6.1.0 you can use the user tag library and its fullName function as follows:

${user:fullName(renderContext.user)}

 

Kind regards

Sergiy

  • Re: How to access the properties of currently logged-in user?
    2012/10/22 21:23

    shyrkov <p> Hello Namit,</p> <p> you can achive it by using:</p> <p> <font face="Courier New, monospace">${renderContext.user.properties[j:firstName]}</font></p> <p> <font face="Courier New, monospace">${renderContext.user.properties[j:lastName]}</font></p> <p> <font face="Courier New, monospace">${renderContext.user.properties[j:email]}</font></p> <p> If you are using Jahia 6.6.1.0 you can use the <a href="http://www.jahia.com/downloads/jahia/jahia6.6.1/jahia-taglib-6.6.1.0-tlddoc/user/tld-summary.html">user tag library</a> and its <a href="http://www.jahia.com/downloads/jahia/jahia6.6.1/jahia-taglib-6.6.1.0-tlddoc/user/fullName.fn.html">fullName</a> function as follows:</p> <p> <font face="Courier New, monospace">${user:fullName(</font><font face="Courier New, monospace">renderContext.user)}</font></p> <p> &nbsp;</p> <p> Kind regards</p> <p> Sergiy</p>

  • Number of messages  407
    Registration date Oct 22, 2012
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page