Forum Discussion

jmurray's avatar
jmurray
Champion
12 years ago

freemarker for user's first name / last name

Is there no way to get first name and last name via freemarker?

 

It wouldn't seem so, according to this: https://lithosphere.lithium.com/t5/developers-knowledge-base/Context-objects-for-custom-components-user/ta-p/9339

 

I may put in an idea.  Just checking to see if this is available in some way I'm unaware of first.  Thanks.

  • Even without direct access through the freemarker custom context user object, there's a vast amount of information that can be unlocked via the REST API using the rest or restadmin context objects. Details here:

    http://lithosphere.lithium.com/t5/developers-knowledge-base/Context-objects-for-custom-components-rest/ta-p/9333

     

    Here's a crude example of getting the user's first and last name, and displaying the result: 

    <#assign nameFirst = rest("/users/id/${user.id?c}/settings/name/profile.name_first").value />
    <#assign nameLast = rest("/users/id/${user.id?c}/settings/name/profile.name_last").value />
    
    Welcome ${nameFirst!""} ${nameLast!""}

     I hope this helps!

  • VenkS's avatar
    VenkS
    Lithium Alumni (Retired)

    I don't believe this functionality is available through the freemarker "user" object.