Forum Discussion

bhupen's avatar
bhupen
Advisor
11 years ago

How to show recent post from a specific role?

Requirement 1:

As a user, I would like to see the most recent 5 posts from users with the role 'aux' . i.e. I have have a user 'abc' and he have the'aux' role. Now i want to show a list of most recent post from 'aux' role.

 

Requirement 2(Its a different from above requiement):

How do i show search module on top navigation?

 

Please suggest me some help for this.

 

Regards

4 Replies

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)
    11 years ago

    bhupen 

     

    1.

    You could try to get the posts using the stream property.

    Then loop into the results and look for the author type="user" to get the user id

    With the user id, you should be able to get your role, and check if it's 'aux' or not.

     

    This is just an idea, I haven't tried it and not sure it will work nor how difficult it would be to code it.

     

    2.

    Please have a look at this thread.

     

  • bhupen's avatar
    bhupen
    Advisor
    11 years ago

    @OlivierS

     I saw the post you referred, my requirement is different. They just call the component on page to show pagination  but I need a way to get 5 recent posts from specific role. i.e. Role 'aux' contain many user but I want whatever the user posts in community, I need to get top 5 posts. from any user in 'Aux' role

  •  

    Some how I created restAPI for this requirement. Now I need help to implement in FTL

     

    Step 1.

    Created following restAPI to consume the users from specific role:

    /restapi/vc/roles/name/psnow/users

     

    Step 2:

    Save the user ids into some list and iterate them one by one to fetch the most latest post from them, 

    API to be used is as follows:

    /restapi/vc/users/id/576931/posts/latest

     

    Regards