Forum Discussion

kbulens's avatar
kbulens
Guide
11 years ago

link to private messages

Hi,

 

i need to add all user related info into a specific block, like the following:

 

<div>
... some code
<@component id="common.widget.user-navigation"/> 

<#if (user.registered == true) >
       <!--  link to the users inbox -->
       < ??? >
      <!-- announcement when/if there are new messages -->
      < ??? >
</#if>

</div>

<@component id="common.widget.user-navigation"/> works just fine, but i have no isea how to call for the other?

5 Replies

  • kbulens you can simply use this link to users inbox

     

    <a href="/t5/notes/privatenotespage">Messages</a>

     

    and to get the messages count, use this REST call:

     

    /users/id/[id]/mailbox/notes/inbox/unread/count

  • kbulens's avatar
    kbulens
    Guide
    11 years ago

    ... can't get the count of unread message to work. 

    tried the following:
    <#if recent.message.post_time.@view_friendly_date[0] > 0>
    ${/users/id/[id]/mailbox/notes/inbox/unread/count} unread messages
    </#if>

    other try
    <#assign recent= rest("/users/id/[id]/mailbox/notes/inbox/unread/count").message /> unread messages <br>
    ... none worked


  • kbulens's avatar
    kbulens
    Guide
    11 years ago

    tried the following:
    <#assign userinfo = rest("/users/id/[id]/mailbox/notes/inbox/unread/count").value /> unread messages

    where userinfo is the name of the common.component,
    i get the following error:

     

    Freemarker template 'preview' processing failed:
    IllegalArgumentException:Argument must be a URL, restCallUri=/users/id/[id]/mailbox/notes/inbox/unread/count?restapi.response_style=view

    ... basicaly i just want to print that number

  • VarunLuthra's avatar
    VarunLuthra
    Advisor
    11 years ago
    I don't see any errors here apart from one, you need to pass the user id, it should fetch you the value.

    to print the number, you need to use ${userinfo}