# Memberpress + WP Discourse (Groups Management)

**URL:** https://meta.discourse.org/t/memberpress-wp-discourse-groups-management/238447
**Category:** WordPress
**Tags:** sso
**Created:** [September 8, 2022, 11:44am UTC](https://meta.discourse.org/t/memberpress-wp-discourse-groups-management/238447 "2022-09-08T11:44:37Z")
**Posts on this page:** 1
**Showing post:** 6

<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: [August 7, 2023, 7:35am UTC](https://meta.discourse.org/t/memberpress-wp-discourse-groups-management/238447/6 "2023-08-07T07:35:01Z")

</div>

> [@earlysound](#):
>
> How would I go about implementing this?

I just had a look at the code. In case it’s not clear, the Memberpress Sync plugin depends on code from the [WP Discourse](https://github.com/discourse/wp-discourse) plugin: [WP Discourse – WordPress plugin | WordPress.org](https://wordpress.org/plugins/wp-discourse/). That means you will also need to install, activate and configure the [WP Discourse](https://github.com/discourse/wp-discourse) plugin: [Connect WP Discourse to Discourse](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490). You will also need to configure your WordPress site as the [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) provider for your Discourse site. Details about setting that up are here: [Configure single sign-on (SSO) with WP Discourse and DiscourseConnect](https://meta.discourse.org/t/wp-discourse-and-discourseconnect/223494).

There’s something in the Memberpress Sync plugin that I’m not sure about. It looks to me as though there are two Memberpress Product IDs and two Discourse groups hard coded into the plugin’s code:

> <https://github.com/paviliondev/wp-discourse-mepr-sync/blob/master/sync.php#L15-L17>

I _think_ you will need to make some changes to that file. The values in the array that’s defined by `PV_MEMBERPRESS_PRODUCT_IDS` will need to be set to your site’s subscription IDs. You will also need to set the `PV_DISCOURSE_ENROLLED_GROUP` and `PV_DISCOURSE_UNENROLLED_GROUP` definitions to groups that exist on your Discourse site.

It seems that the plugin adds any users who have an active subscription for any of your products to the `PV_DISCOURSE_ENROLLED_GROUP`. If a user who had one or more active subscriptions then has all their subscriptions expire, they will be removed from the `PV_DISCOURSE_ENROLLED_GROUP` and added to the `PV_DISCOURSE_UNENROLLED_GROUP`.

Maybe @fzngagan can confirm if this is correct? If it is, it will be fairly straightforward to setup the code for @earlysound’s site. It’s possible I’m misunderstanding how the plugin works though. I don’t have a copy of the Memberpress plugin. If I could get access to a development version of Memberpress, I could test it out myself.

---

_[View the full topic](https://meta.discourse.org/t/memberpress-wp-discourse-groups-management/238447)._
