Forum Discussion

frardouin's avatar
7 years ago

How to display avatar and login name of the current logged user in a custom document

Hi, I'm new to lithium and I'm try to get my head around something. I'm trying to understand how to query the info of the current user and display it in a freemarker custom component (it's for a cust...
  • Payal's avatar
    Payal
    7 years ago

    Hi frardouin,

    You can use the folllowing v2 query to get the current logged user info:

     

     

    <#assign userInfo = rest("2.0", "/search?q=" + "Select * from users where id = '${user.id}'"?url).data.items />
    
    <#list userInfo as getInfo>
    <span>${getInfo.first_name}</span>
    <span>${getInfo.last_name}</span>
    <span>${getInfo.login}</span>
    <span>${getInfo.avatar.profile}</span>
    </#list>

     Let me know if it works for you.

     

    Thanks,