Forum Discussion

Puljac's avatar
Puljac
Maven
11 years ago

How to make online/offline user information status

Hi i want to make information REST call so this info would be in a POST page below user which post a message.

 

for example this:

 

Online/offline

 

It will show GREY icon when user is offline and GREEN icon when he is online.

 

I found CALL community/restapi/vc/users/online

 

and now what ? :-)

 

 


Capture.JPG

3 Replies

  • @Puljac - You can use the following snippet, you can make the changes as per your requirement.

     

    <#attempt> 
    <#assign onlineStatus = rest("/users/id/${author.id}/sessions/online/latest")>
    <#recover>
    <#-- Cat. not there -->
    </#attempt> <#assign isRegistered = onlineStatus.user_session.@null /> <#if (isRegistered?has_content) > <#assign registeredString = "Offline"/> <#assign registeredClass = "Offline" /> <#else> <#assign registeredString = "Online" /> <#assign registeredClass = "Online" /> </#if>

     

    You can register for our Webinar on lithium, follow the link in the signature.

  • Puljac's avatar
    Puljac
    Maven
    11 years ago

    Thank you VarunGrazitti .

     

    So basically i make a component with this snippet and put it in POST page.

     

    I tried and have freemarker errors....

     

     

  • You'll need to use this in the forum message page, and in place of [id], need to use the message user id. You can get the message ID

     

    <#assign messageId = env.context.message.id />