# Convert Public Forum To Private for paid clients only

**URL:** https://meta.discourse.org/t/convert-public-forum-to-private-for-paid-clients-only/116845
**Category:** Support
**Created:** [4 mei 2019 om 16:17 UTC](https://meta.discourse.org/t/convert-public-forum-to-private-for-paid-clients-only/116845 "2019-05-04T16:17:36Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [4 mei 2019 om 16:24 UTC](https://meta.discourse.org/t/convert-public-forum-to-private-for-paid-clients-only/116845/6 "2019-05-04T16:24:51Z")

</div>

If your WordPress users are a mixture of paying customers and registrants who aren’t allowed access then a common apporach is to use a plugin such as PaidMembershipsPro. By adding code to your themes functions.php your WordPress site can send group memberships over to your Discourse site.

Then in addition to ‘Login Required’ you can secure your categories behind groups which are populated by the WordPress plugin and SSO process.

The example code is in this post:

> [@Manage group membership in Discourse with WP Discourse SSO](https://meta.discourse.org/t/managing-discourse-group-membership-with-wp-discourse/74724):
>
> [WP Discourse](https://github.com/discourse/wp-discourse) functions The [WP Discourse](https://github.com/discourse/wp-discourse) plugin has a couple of functions that can be used to associate WordPress users with Discourse groups. These functions are only enabled on sites that are using WordPress as the SSO provider for Discourse. add\_user\_to\_discourse\_group( $user\_id, $group\_names ) [View Code](https://github.com/discourse/wp-discourse/blob/main/lib/utilities.php#L278-L301) remove\_user\_from\_discourse\_group( $user\_id, $group\_names ) [View Code](https://github.com/discourse/wp-discourse/blob/main/lib/utilities.php#L303-L326) Each of these functions take the same two parameters: $user\_id: the WordPress user’s id $group\_names: a comma separat…

It’s not perfect, I believe @dfriestedt was working with @justin to clean it up and make the code more widely available:

> [@Integration between paidmembershipspro.com and Discourse](https://meta.discourse.org/t/integration-between-paidmembershipspro-com-and-discourse/112369):
>
> What would you like done? I’m looking to integrate [paidmembershipspro.com](http://paidmembershipspro.com) with discourse so when a member signs up to a recurring subscription they are added to a private member group in discourse. when that member stops paying for the membership they are removed from the discourse private group. When do you need it done? No rush. What is your budget, in $ USD that you can offer for this task? What ever is fair. However, I would like to make it open source so others can use it too for fre…

You’ve not elaborated on how you’re managing users or selling memberships on the WordPress side, so that’s the best I can do for now.

---

_[View the full topic](https://meta.discourse.org/t/convert-public-forum-to-private-for-paid-clients-only/116845)._
