How to create a 'follow' button for a topic and post it on an external website?


(Andy at Focallocal) #1

The Wordpress Sycn plugin gives the ability to auto post your WP articles to a thread in our discourse forum.

Is it possible to put a ‘follow’ button into my wordpress articles which subscribes my users to that topic? (or redirects them to the login page if they aren’t logged in)

Essentially creating a notification of new articles posted if users click the button, Wordpress is terrible for that on its own.

Thanks


(Simon Cossar) #2

You can set a user’s notification level for a topic through the API. You’ll need to generate an API key for the user first, and then make a POST request to /t/$topic_id/notifications with the user’s api_key, api_username, and the notification_level in the body of the request. To avoid exposing the API key, the request will have to be made from the server, not the client.

The easiest way to deal with this would be to only show the Follow button to logged in users.


(Andy at Focallocal) #3

thanks. that’s a bit beyond my level, but i’ll pass it on to others in my team and see if they can set it up