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-com...
  • AdamN's avatar
    AdamN
    12 years ago

    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!