Auto activated accounts for WP Discourse SSO?

Hi,

I set up WP Discourse and configure it. I use Wordpress login system. I enabled “Sync user data.” option on WP Discourse. But when i create new account on Wordpress, it created on Discourse too but not activated. Discourse sends activation email again.

Any ideas?

2 Likes

If you are not using the default WordPress login system, user’s emails will be marked as being unverified. This causes Discourse to send the activation email to confirm that the address belongs to the user. If this is what is happening, you can either leave it as it is, or get around it by adding some code to your theme to confirm that the email address is verified.

See this post for more details: How to turn off Discourse email verification?

I am using Wordpress with BuddyPress. Except this, there is no plugin related to login system.

When i add function in function.php

**Parse error** : syntax error, unexpected ')' in **functions.php** on line **1494**

Right, that function will not work unless you replace this part /* some condition */.

From what I remember of BuddyPress, it adds a signup form to the site that lets users create an account and login without verifying their email address. Is this how it works on your site?

1 Like

I create account with username and mail information. When i created account, Wordpress send me password reset mail and sending a link for my password creation.

1 Like

As long as users are not automatically logged in before responding to the password reset email, you can use this function. It will work without any changes:

add_filter( 'discourse_email_verification', 'wpdc_custom_disable_email_verification' );
function wpdc_custom_disable_email_verification() {

    return false;
}
2 Likes

Thank you @simon. It works! :slight_smile:

Hello,

I have a similar problem with the activation. I added this code in my functions.php file and when I want to log on discourse I have this error message :

Your account is pending approval. You will receive an email notification when you are approved.

How can I automatically approved new account ?

Thanks for your help,
Eric

Hi @Zaelech. It seems your functions unaffected. Are you sure you’re editing the right functions.php file? It must be in the your active theme directory.

Hi @bekircem,
No I’m sure, the function.php is the good one, because I have other add_filters in this file and no problem with them.
It’s weird because after my first installation, it’s working fine but now, I have this error after each sso login :frowning:

And in the BO the user is active:

I think I have a configuration problem : For discourse for login a user need to be approved.

Ok my bad, I had the option must approve users checked :slight_smile:

5 Likes