# Create user automatically in Discourse when they sign up in Wordpress?

**URL:** https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494
**Category:** WordPress
**Created:** [06.Март.2017 19:35:34 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494 "2017-03-06T19:35:34Z")
**Posts on this page:** 11
**Page:** 2

<div class="post-metadata">

### Author: ![rodeezy](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rodeezy](https://meta.discourse.org/u/rodeezy)
#### Post date: [26.Октябрь.2017 21:47:35 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/21 "2017-10-26T21:47:35Z")

</div>

this is an awesome idea

---

<div class="post-metadata">

### Author: ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)
#### Post date: [14.Декабрь.2017 18:47:09 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/23 "2017-12-14T18:47:09Z")

</div>

The option to create a new user wasn’t working for me so I dug into the plugin code and figured out why. In case this is helpful to anyone else:

The **create\_discourse\_user** function runs as a result of WP’s **wp\_login**  **action** but for some reason, **wp\_login** doesn’t get fired in my setup of WP when someone creates an account.

It’s probably because we use the WP plugin MemberMouse to handle members and it hijacks the registration/login system in unexpected ways.

So I added in a new way of firing off **create\_discourse\_user** and it works now.

---

<div class="post-metadata">

### Author: ![rodeezy](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rodeezy](https://meta.discourse.org/u/rodeezy)
#### Post date: [13.Март.2018 01:32:14 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/24 "2018-03-13T01:32:14Z")

</div>

any instructions on implementing this?

---

<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: [13.Март.2018 01:38:28 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/25 "2018-03-13T01:38:28Z")

</div>

It can be done with the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. You need to be using WordPress as the SSO provider for Discourse and also select the SSO Provider option Create or Sync Discourse Users on Login.

There are cases where this doesn’t work due to conflicts with other plugins. If you run into a problem with it, let us know and we’ll try to work it out.

The code that I posted in this topic is no longer necessary.

---

<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: [20.Июнь.2018 12:47:23 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/27 "2018-06-20T12:47:23Z")

</div>

Hello,

I activated the WordPress as the SSO provider for Discourse and also select the SSO Provider option Create or Sync Discourse Users on Login

But after a login with a new user, this user doesn’t appear in discourse’s back office.

Do you have an idea for solve that ?

Thanks for your help  
Eric

---

<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: [20.Июнь.2018 16:31:44 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/28 "2018-06-20T16:31:44Z")

</div>

> [@Zaelech](#):
>
> I activated the WordPress as the SSO provider for Discourse and also select the SSO Provider option Create or Sync Discourse Users on Login
> 
> But after a login with a new user, this user doesn’t appear in discourse’s back office.

Is SSO working correctly for you when a user clicks the Login button on Discourse?

---

<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: [21.Июнь.2018 07:53:59 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/29 "2018-06-21T07:53:59Z")

</div>

Yes the SSO is working fine, I can connect to discourse and the user is created at this moment.  
But For my project I need to create the user after account creation in wordpress because for some users I want to change the level of them after a subscription in wordpress.

Thanks for your help

---

<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: [21.Июнь.2018 08:09:47 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/30 "2018-06-21T08:09:47Z")

</div>

> [@Zaelech](#):
>
> I need to create the user after account creation in wordpress

This should work. Sometimes there is a conflict with another plugin. What are the main plugins on your site?

---

<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: [21.Июнь.2018 09:22:21 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/31 "2018-06-21T09:22:21Z")

</div>

I have this plugins:

 ![plugins](https://global.discourse-cdn.com/meta/original/3X/d/b/db4941503963cf0b6ea15cc6de994fc45e34dcb2.png)

---

<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: [21.Июнь.2018 09:42:02 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/32 "2018-06-21T09:42:02Z")

</div>

I find the problem the publishing username of my api has a space and special characters, after i Changed it on the configuration, the transmission is ok:

 ![publishing_username](https://global.discourse-cdn.com/meta/original/3X/7/f/7ff97a773be7cb7694bfca5cb59873b26887bf75.png)

Thanks 😉

---

<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: [21.Июнь.2018 15:17:22 UTC](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494/33 "2018-06-21T15:17:22Z")

</div>

Great! Yes, that makes sense. SSO works without the API key, but the sync\_user function requires the API key and Publishing Username.

[Previous page](https://meta.discourse.org/t/create-user-automatically-in-discourse-when-they-sign-up-in-wordpress/58494.md?page=1)
