# Embed Discourse sign-up on WP page, add new user to a specific Group automatically?

**URL:** https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707
**Category:** Support
**Created:** [January 15, 2020, 5:31pm UTC](https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707 "2020-01-15T17:31:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [January 15, 2020, 5:31pm UTC](https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707/1 "2020-01-15T17:31:14Z")

</div>

I’m looking to let a certain group of folks sign-up for my Discourse. Preference would be the following:

1. Visit WP or Discourse page for sign-up, asking for username, email, pass (if necessary; can auto-create too)
2. User gets added to Discourse, plus added to a Group

Is this possible outside of Memberful?

---

<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: [January 15, 2020, 5:43pm UTC](https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707/2 "2020-01-15T17:43:06Z")

</div>

> [@waffleslop](#):
>
> - Visit WP or Discourse page for sign-up, asking for username, email, pass (if necessary; can auto-create too)
> - User gets added to Discourse, plus added to a Group

You could accomplish this by using your WordPress site as the Single Sign On provider for your Discourse site. The [WP Discourse plugin](https://wordpress.org/plugins/wp-discourse/) has an SSO Provider option that can be used to set this up.

The tricky part is getting users into Discourse groups. To do this with the [WP Discourse](https://github.com/discourse/wp-discourse) plugin you will need to add some code to your WordPress site. There are code examples on this forum that we can point you to for adding users to groups, but you need some way of determining what Discourse groups your WordPress users should get added to. One way to accomplish this is to add a membership plugin to your WordPress site and then add users to Discourse groups based on their WordPress membership level.

To have users signup and get added to Discourse groups without you having to add any custom code, you could look at the [Discourse Patreon plugin](https://meta.discourse.org/t/discourse-patreon-integration/44366). Memberful is also a good option.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 15, 2020, 5:49pm UTC](https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707/3 "2020-01-15T17:49:38Z")

</div>

You want something like

```php
if ( class_exists( '\WPDiscourse\Discourse\Discourse' ) ) {
    add_filter( 'wpdc_sso_params', 'wpdc_custom_sso_params', 10, 2 );
}
function wpdc_custom_sso_params( $params, $user ) {
    $groups = get_group_list_for_current_user();
    if ( strlen($groups) > 0 ) {
        $params['add_groups'] = $groups;
    }
    return $params;
}

```

will work. `get_group_list_for_current_user` is left as an exercise to the reader. 😉

If that doesn’t help and you have a budget, you can ask in #Marketplace or contact me.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 20, 2023, 10:34am UTC](https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707/4 "2023-11-20T10:34:05Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [February 4, 2024, 8:43am UTC](https://meta.discourse.org/t/embed-discourse-sign-up-on-wp-page-add-new-user-to-a-specific-group-automatically/138707/5 "2024-02-04T08:43:56Z")

</div>


