Forum Discussion

Puljac's avatar
Puljac
Maven
12 years ago

Member recent posts

Hi to all,    I have questions from community members "I can't find my posts that i posted, where to see if somebody replyed to my query".   Instead of searching through categories and posts, bas...
  • nathan's avatar
    12 years ago

    Puljac- we created a custom component for one of our communities that shows the user their five most recent posts. Here's a code snippet that shows how you can do this:

     

    <#if user.id != -1>
    <div class="RecentPosts">
    ...
        <#assign recentPosts = rest("/users/id/${user.id}/posts?page_size=5&restapi.response_style=view").node_message_context.message />
        <ul>
        <#list  recentPosts as recentPost>
            <li><a href="${recentPost.@view_href}">${recentPost.subject}</a></li>
        </#list>
        </ul>
    ...
    </div>
    </#if>