Background: My company runs an internal Discourse Forum, as well as an internal WordPress site. The forums are configured to use SSO from the WordPress instance. On the forums, there is a category called “Updates”. On the WordPress side, when a user logs in there is the following PHP function:
$results = $this->_getRequest("c/updates.json", null, $username);
$results are then parsed. For each topic, if the
last_read_post_number < highest_post_number then we assume the user hasn’t fully read the topic and display an excerpt of the topic in a div on the WordPress site. In the div, there is an
X. The intention is that clicking the
X will set the user’s
last_read_post_number equal to the
highest_post_number so it is “read” in the forums too.
This was initially set up over a year ago by adding a custom controller and route to make the
last_read_post_number. Problem is the route was set in a way that overwrote the Discourse
routes.rb file, causing intermittent and eventually permanent problems.
Is there a way to do this via a simple API call (or calls)?