# Come posso limitare l'accesso al mio forum Discourse per gli utenti che hanno smesso di pagare l'iscrizione?

**URL:** https://meta.discourse.org/t/how-can-i-restrict-access-to-my-discourse-forum-for-users-who-have-stopped-paying-for-my-membership/104195
**Category:** WordPress
**Created:** [13 Dicembre 2018, 3:47pm UTC](https://meta.discourse.org/t/how-can-i-restrict-access-to-my-discourse-forum-for-users-who-have-stopped-paying-for-my-membership/104195 "2018-12-13T15:47:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ryan\_Collins1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_collins1/32/76781_2.png) [@Ryan\_Collins1](https://meta.discourse.org/u/Ryan_Collins1)
#### Post date: [13 Dicembre 2018, 3:47pm UTC](https://meta.discourse.org/t/how-can-i-restrict-access-to-my-discourse-forum-for-users-who-have-stopped-paying-for-my-membership/104195/1 "2018-12-13T15:47:14Z")

</div>

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 😃

Ryan

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [13 Dicembre 2018, 4:39pm UTC](https://meta.discourse.org/t/how-can-i-restrict-access-to-my-discourse-forum-for-users-who-have-stopped-paying-for-my-membership/104195/2 "2018-12-13T16:39:21Z")

</div>

The [Discourse Patreon](https://meta.discourse.org/t/discourse-patreon-integration/44366) plugin will remove access when a patron cancels their pledge immediately using webhooks.

Not sure about how [ProCourse Memberships 💸](https://meta.discourse.org/t/procourse-memberships/57558) handles it, but it’s a standard feature to expect of a plugin of this type.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [13 Dicembre 2018, 5:44pm UTC](https://meta.discourse.org/t/how-can-i-restrict-access-to-my-discourse-forum-for-users-who-have-stopped-paying-for-my-membership/104195/3 "2018-12-13T17:44:06Z")

</div>

> [@Ryan\_Collins1](#):
>
> 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.

I am assuming you are using the [WP Discourse](https://github.com/discourse/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 - #2 by simon](https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234/2).

---

<div class="post-metadata">

### Author: ![Ryan\_Collins1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_collins1/32/76781_2.png) [@Ryan\_Collins1](https://meta.discourse.org/u/Ryan_Collins1)
#### Post date: [14 Dicembre 2018, 11:04pm UTC](https://meta.discourse.org/t/how-can-i-restrict-access-to-my-discourse-forum-for-users-who-have-stopped-paying-for-my-membership/104195/5 "2018-12-14T23:04:54Z")

</div>

Yes, I am using the [WP Discourse](https://github.com/discourse/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( [myfishingcapecod.com/billing-update-page/()](http://myfishingcapecod.com/billing-update-page/()) );

Thank you very much for the support. Huge help!
