How can I restrict access to my Discourse forum for users who have stopped paying for my membership?

Hi team,

For the past two years I’ve been using s2member in conjunction with SSO to give users of my wordpress membership site access to my “member-only” Discourse forum.

Over the past two years, several hundred users have either cancelled their membership or their credit card payments were declined. When this happens, these users instantly lose access to my wordpress website, however they can still access my Discourse forum.

Ideally when someone cancels membership with my site, they should also lose access to my forum. When they try to access the forum they should be sent to a specific page on my website where they can update their billing information in order to re-gain access to the forum.

Does there exist a solution for this type of scenario?

I appreciate your recommendations :smiley:


The Discourse Patreon Integration plugin will remove access when a patron cancels their pledge immediately using webhooks.

Not sure about how ProCourse Memberships 💸 handles it, but it’s a standard feature to expect of a plugin of this type.


I am assuming you are using the WP Discourse plugin. There is nothing built into the plugin to handle this, but it can be done by adding some code to your site. Have a look at this post: How to prevent some WP users from being able to login to Discourse.


Yes, I am using the WP Discourse.

Thanks for sharing that link and the code about how to prevent some WP users from being able to login to Discourse. Big help!

I just have 3 additional questions for whenever you are able to reply:

  1. Should I add that code to my theme’s functions.php file?

  2. When a member cancels, they transition in wordpress from being a “s2Member Level 1” to a “Subscriber” - should I put if ( /* Subscriber */ ) { in order to make it work?

  3. If want to redirect Subscribers to a different page aside from the homepage, do I just change home_url with a the url of my billing update page? (wp_safe_redirect( );

Thank you very much for the support. Huge help!