How to manually add user in discourse?

(Jaka Permana) #1

how to create user in admin discourse ?
plis help me, then answer step by step

thanks

1 Like
(Jay Pfaffman) #2

Are you trying to add one user or one hundred?

to invite a user

  • Click your avatar,
  • click gear,
  • click invites
  • type their email address or ou can invite a bunch of people with a CSV file

Create an account

  • log out
  • create account (as the user would)
  • log in as admin
  • admin/users
  • find the user
  • activate
9 Likes
(Jaka Permana) #3

it’s working , thanks for information :+1::ok_hand:

1 Like
(Erik Sundell) #4

I want to create a user to act as a service account, but I’m using single sign on and would need to do quite a bit of work to actually get a service account from the underlying user provider there. In other words, I don’t know how to do the create an account step or invite step.

I understand I could create a new user by switching away from SSO for a while and then back, is that what I need to do or can I manage to create a user without doing this?

Perhaps there is a ruby related command I can run from the terminal of my virtual machine that has a /var/discourse folder with ./launcher etc in it.

Perhaps there is a SQL query I can run from somewhere?

(Jay Pfaffman) #5

Then maybe what you want is

cd /var/discourse 
rake admin:create

In spite of the name, making the user an admin is optional.

Edit : oops left out enter app as noted below

2 Likes
(Erik Sundell) #6

Aha! Tank you for your help @pfaffman!

This is what I did for my docker-stacks installation that got “Command ‘rake’ not found” without adding some steps.

sudo -s
cd /var/discourse
./launcher enter app
rake admin:create

Tadaaaaaaaaa! Verified success!

3 Likes
(Jay Pfaffman) #7

Oops! Sorry. I was poking on my phone before having coffee. :slight_smile:

Glad it was enough to get you there.

1 Like
#9

Has the method of inviting a single user from your User Preferences page (gear icon) changed? I see no reference to anything regarding an “invite” on that page. Thanks.

Nevermind. I see where invites are disabled with SSO

4 Likes
(Dino45) #10
rails c
u = User.create!(username: "name", email: "name@email.com", password: "password")
u.approve(Discourse.system_user, false) # if manual approvals are required
u.activate

If the user should be an admin, add , admin: true to the create line inside the parentheses; likewise for moderators.

3 Likes