Manually created staged user?

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.

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.

2 Likes

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 :joy:

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

3 Likes

Please, could Discard ask simple are you sure :man_facepalming:

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:

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.

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

Yep, that approach should also work.

Except… I can’t change ownership of PM to a staged user :man_facepalming:

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 :stuck_out_tongue_winking_eye: That is a victory too. Plus I created a staged user I can’t do anything with.

newsuser.destroy

(note NOT “delete”)

1 Like

Another way I found is:

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

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

3) Send an email to that email address

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

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?)

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

1 Like

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.)

1 Like

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 :thinking:

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) :joy:

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

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 :smirk:

1 Like

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.

:exploding_head:

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.