# Manually created staged user?

**URL:** https://meta.discourse.org/t/manually-created-staged-user/340909
**Category:** Support
**Created:** [December 6, 2024, 12:56pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909 "2024-12-06T12:56:23Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 6, 2024, 12:56pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/1 "2024-12-06T12:56:23Z")

</div>

Can I create a staged user manually? Using rake, I can create an ordinary one, of course. The all-knowing AI told me I can’t, and I believe it, but still…

Perhaps I should explain what I am trying to do.

I have a WordPress/WooCommerce setup where a customer can book an appointment. The customer will send additional information using a form served by WordPress. That form is sent to (my) group inbox. However, because I’m using Amazon SES, I can’t use the customer’s email as the sender, because then I must approve that sender manually, and that is not an option. So, I receive the email from my WordPress address.

Now, I need to connect somehow, automatically, or with very little effort from my side, that PM topic with the customer’s email. And the only solution my limited knowledge came up with was changing ownership — but for that, I need a user.

Why don’t I use OAuth and create that user, since they have to create an account on WordPress? Because I just can’t understand how to do it, or I haven’t found the right topic here. Quite often, the suggested SSO is not an option, because it hijacks every other login option.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 6, 2024, 1:20pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/2 "2024-12-06T13:20:38Z")

</div>

Try entering the container `./launcher enter app`

then go into rails console:

`rails c`

create a new user:

`new_user = User.create`

then … and this will fail initially, try to save it (to instantiate it)

`new_user.save!`

follow the instructions on filling in the invalid attributes until it saves.

e.g.

`new_user.username = 'frank'`

will get past one validation error.

Rinse and repeat, eventually the user will save.

simply type `new_user` to see how far you’ve got but know you do _not_ need to complete every field, only those with a validation issue.

Do not forget to save it, as new\_user will be a temporary object until save works.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 6, 2024, 1:43pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/3 "2024-12-06T13:43:27Z")

</div>

I’m just wondering… there is this: `staged: false`

How can I see all of that data from real staged user? Or am I only jumping in the too deep water now and trying to do desperate things, and I should just create those users manually via _create accont_ 😂

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 6, 2024, 1:48pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/4 "2024-12-06T13:48:20Z")

</div>

`User.where(staged: true).first(10)`

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 6, 2024, 2:29pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/5 "2024-12-06T14:29:35Z")

</div>

Please, could Discard ask simple _are you sure_ 🤦‍♂️

Again. I don’t know if this works, because I was stupid enough to work with real case, so I can’t test it. But I have brand new staged user.

This I did:

```plaintext
newuser = User.create
newuser.username = 'frank'
newuser.staged = true
newuser.email = 'frank@example.tld'
newuser.save!

```

I think this could work too, but I haven’t tried it.

```plaintext
newuser = User.create!(username: "frank", staged: true, email: "frank@example.tld")

```

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 6, 2024, 2:31pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/6 "2024-12-06T14:31:39Z")

</div>

Yep, that approach should also work.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 6, 2024, 2:44pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/7 "2024-12-06T14:44:45Z")

</div>

Except… I can’t change ownership of PM to a staged user 🤦‍♂️

So, as long as I don’t start building oauth thing, my only option is send a PM to that user’s email. Same staging will happen, if I’m understanding right.

Or I approve that user. That is an option. I prefer not, though, because then I would do it without consent.

But now I know basics of how to create/edit a user using rails 😜 That is a victory too. Plus I created a staged user I can’t do anything with.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 6, 2024, 3:03pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/8 "2024-12-06T15:03:04Z")

</div>

`newsuser.destroy`

(note NOT “delete”)

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [December 18, 2024, 10:31pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/9 "2024-12-18T22:31:39Z")

</div>

Another way I found is:

#### 1) Create a Category… (I named mine Inbox)

 ![Screenshot 2024-12-18 152639](https://global.discourse-cdn.com/meta/original/4X/4/7/7/4774ef1457d8729ea0b10abcb112c004a4dfed28.jpeg)

#### 2) In the Settings for that category, enable “Accept emails from anonymous users with no accounts”

 ![Screenshot 2024-12-18 152403](https://global.discourse-cdn.com/meta/original/4X/0/9/4/09490c8f5dec7c80007318aa150f757020729757.jpeg)

#### 3) Send an email to that email address

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 18, 2024, 11:15pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/10 "2024-12-18T23:15:45Z")

</div>

I don’t follow 🤔 How can I send an email from strange address to create that staged user and how is that different than using a group address?

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [December 18, 2024, 11:27pm UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/11 "2024-12-18T23:27:30Z")

</div>

I have only sought the most simple way to manually create a staged user (for my specific use of creating new Topics on my own private forum by emailing from my watch). I’m sure there are many other methods!

(Did you try it?)

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 19, 2024, 12:09am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/12 "2024-12-19T00:09:12Z")

</div>

No, because I still don’t understand how can I send an email using address that isn’t mine.

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [December 19, 2024, 2:39am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/13 "2024-12-19T02:39:20Z")

</div>

In my example above I sent an email from my normal email address I use every day…

to…

the email address I put in the category setting for the new _ **Inbox** _ category I created, in this case (as shown in my example above) `inbox@forum.mysite.com` which is of course also an email address I own (because the domain is the same as the domain of my forum.)

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 19, 2024, 6:51am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/14 "2024-12-19T06:51:19Z")

</div>

But Jagster wants to create a stage user for his user. He cannot send an email for them.

Maybe sending a personal message to an email address could work in this case 🤔

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 19, 2024, 8:18am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/15 "2024-12-19T08:18:22Z")

</div>

I was asking how do I create a staged user (in the meaning as kind of pre-TL) for a real person without need to ask that person send an email to forum.

We hit against huge language barrier again, I assume (we desperate need that AI-translator) 😂

For creating dummy person, staged or registered, is really easy task with iPhone.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 19, 2024, 8:26am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/16 "2024-12-19T08:26:18Z")

</div>

> [@Moin](#):
>
> Maybe sending a personal message to an email address could work in this case

So I solved it out. At same time I get chance to explain what I was doing. But again, creating a staged user wouldn’t be the real issue I was trying to solve, but connecting follow-ups to my WooCommerce — so did what is a norm nowadays: I came to **one** solution and asked that one. But that was intentionally, because I knew I can’t ask how do I send email from WooCommerce where sender is that user, and Amazon SES won’t do that. Or how do I sync my WordPress users to forum automatically, because that is practically an unlegal action.

So, creating manually a staged user was all I could came to 😏

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [December 19, 2024, 8:28am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/17 "2024-12-19T08:28:44Z")

</div>

I’m not sure I fully understand the specific routing requirements for Jagster’s use case.

But I am receiving emails into my Discourse Inbox category (as I have described above) from an email address that I cannot send from. These are emails from a client that I correspond with using my Gmail account.

Here’s how I set it up…

In my Gmail account, I set up a filter that catches all emails received from that client’s email address, which (while also keeping a copy in Gmail) then forwards those emails to the email address I have designated to receive emails into the Inbox category in my Discourse instance.

I suppose I could also (or alternatively) set that Inbox category (in it’s category settings) to “mirror a mailing list” which I (and optionally others) could then subscribe to as well.

🤯

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [December 19, 2024, 8:45am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/18 "2024-12-19T08:45:07Z")

</div>

Those users haven’t sended anything, that is the issue. If they would I had plenty of options and group messages is for me the most practically solution.

and back to the real problem. When an user buys a service they get link to a form created by a plugin in WooCommerce. No, I can’t use Discourse for that, because you know, they aren’t anykind users. I can send that form to Discourse, but only from from approved addresses, and customer’s addresses aren’t and won’t be approved in SES. So I need to connect that customer together that sended form, now a PM, somehow. Then I can continue with that customer in forum, because of all the tools it offers.

---

<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: [January 18, 2025, 8:45am UTC](https://meta.discourse.org/t/manually-created-staged-user/340909/19 "2025-01-18T08:45:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
