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

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?

1 Like

You could accomplish this by using your WordPress site as the Single Sign On provider for your Discourse site. The WP Discourse plugin 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 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. Memberful is also a good option.

1 Like

You want something like

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. :wink:

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