Memberpress: how to add users to groups upon Sign up

The easiest approach is to use the Discourse WordPress plugin: WP Discourse – WordPress plugin | WordPress.org and enable Single Sign On between WordPress and your forum. This will make your WordPress site responsible for all user authentication on Discourse.

To automatically add users to groups will require a bit of custom code. The WP Discourse plugin has a couple of functions that can be used when SSO is enabled for automatically adding and removing users from Discourse groups. The functions are add_user_to_discourse_group and remove_user_from_discourse_group. You can find them here: https://github.com/discourse/wp-discourse/blob/master/lib/utilities.php#L309.

There is some information about using these functions in this topic: Managing Discourse group membership with WP Discourse SSO.

3 Likes