# Auto activated accounts for WP Discourse SSO?

**URL:** https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272
**Category:** WordPress
**Created:** [June 20, 2018, 5:35am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272 "2018-06-20T05:35:47Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 20, 2018, 5:35am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/1 "2018-06-20T05:35:47Z")

</div>

Hi,

I set up [WP Discourse](https://github.com/discourse/wp-discourse) and configure it. I use Wordpress login system. I enabled “Sync user data.” option on [WP Discourse](https://github.com/discourse/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?

---

<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: [June 20, 2018, 6:35am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/2 "2018-06-20T06:35:26Z")

</div>

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? - #4 by simon](https://meta.discourse.org/t/how-to-turn-off-discourse-email-verification/75365/4)

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 20, 2018, 7:08am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/3 "2018-06-20T07:08:18Z")

</div>

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** `

---

<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: [June 20, 2018, 7:15am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/4 "2018-06-20T07:15:12Z")

</div>

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

> [@bekircem](#):
>
> I am using Wordpress with BuddyPress

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?

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 20, 2018, 7:17am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/5 "2018-06-20T07:17:01Z")

</div>

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.

---

<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: [June 20, 2018, 7:20am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/6 "2018-06-20T07:20:50Z")

</div>

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:

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

    return false;
}

```

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 20, 2018, 7:33am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/7 "2018-06-20T07:33:47Z")

</div>

> [@simon](#):
>
> add\_filter( ‘discourse\_email\_verification’, ‘wpdc\_custom\_disable\_email\_verification’ ); function wpdc\_custom\_disable\_email\_verification() { return false; }

Thank you @simon. It works! 🙂

---

<div class="post-metadata">

### Author: ![Zaelech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zaelech/32/99374_2.png) [@Zaelech](https://meta.discourse.org/u/Zaelech)
#### Post date: [June 20, 2018, 7:53am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/8 "2018-06-20T07:53:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 20, 2018, 7:55am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/9 "2018-06-20T07:55:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Zaelech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zaelech/32/99374_2.png) [@Zaelech](https://meta.discourse.org/u/Zaelech)
#### Post date: [June 20, 2018, 8:15am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/10 "2018-06-20T08:15:44Z")

</div>

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 ☹

---

<div class="post-metadata">

### Author: ![Zaelech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zaelech/32/99374_2.png) [@Zaelech](https://meta.discourse.org/u/Zaelech)
#### Post date: [June 20, 2018, 8:21am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/11 "2018-06-20T08:21:13Z")

</div>

And in the BO the user is active:

 ![bug-active-users](https://global.discourse-cdn.com/meta/original/3X/d/a/dae56e7a5c9420b494ef509f79a6dd050b1a3d18.png)

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

---

<div class="post-metadata">

### Author: ![Zaelech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zaelech/32/99374_2.png) [@Zaelech](https://meta.discourse.org/u/Zaelech)
#### Post date: [June 20, 2018, 8:47am UTC](https://meta.discourse.org/t/auto-activated-accounts-for-wp-discourse-sso/90272/12 "2018-06-20T08:47:58Z")

</div>

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