Forum Discussion

Warren_Brill's avatar
8 years ago

Is it possible to programmatically mark all posts on a board prior to a defined date as read-only?

Is it possible to programmatically mark all posts on a board prior to a defined date as read-only?

  • Warren_Brill- You can set read_only true using API v2 as mentioned by ClaudiusH, since this is an API V2 call, so you need to call it outside of Lithium using OAuth 2.0 flow.

    There is a simple API v1 solution as well which can work on a custom component or endpoint.

    You need to make two calls.

    1.

    select * from messages where board.id = 'boardID' and post_time < 'Specify msg Post_time'

     2.  You can loop through the fetched messages and pass the Message ID to the following :

      <#assign closemsgs = restadmin("/messages/id/${msgId}/readonly/set") />