Forum Discussion

Suchith's avatar
7 years ago

Filter User Collection based on last_visited_date or last_mosified date and time.

Hello,

Is it possible to filter User collection based of last_visited_date or last_modified date and time?

Thanks,
Suchith

  • Suchith you can use API V2 to pull a user list based on last_visited_date, eg.
    SELECT login, avatar, view_href FROM users WHERE last_visit_time > 2017-12-25T10:04:30+10:00 LIMIT 30

    Happy Xmas


    • Suchith's avatar
      Suchith
      Ace

      Hi Peterlu,

      User collections doesn't support last_visit_attribute to use as a constraint. 

      Thanks,

      Suchith

      • peterlu's avatar
        peterlu
        Champion

        SuchithI guess your use case is to list recent active users. There may be some work around. Eg. You can create a hidden board and create an admin post. And create a meta field for the post to store user id. I think there is a Lithium trigger, when user login every time, it can poke to a endpoint. In the endpoint you can create replies to this post with the user id. Then you can use the API V2 message object to query the recent posts for recent users.

        Or post a Lithium idea to ask Lithium to add the last_visited_time as a WHERE constrain :)