frardouin
7 years agoGuide
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 custom top menu). I need the first name, last name, login name and avatar. But it's more how to build the query to get the user of the current session. Thanks a lot.
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,