Registering without admin panel login

Hello there!
I have a question.
How can i make registering without admin panel login.
I mean user can register in website.So there’s no need to admin create user in panel.
Thanks.

What are you planning to use those user accounts for? Meaning: What will the users be supposed to do after they register?

Im new kirby developer mean ill started kirby to discover i try new things,people can register and change informations.
Like password,birth date etc.
There’s only one problem.
How can they register easily without panel?
or what kirby using password encrypt type? i will try php create file in accounts section but i dont know how im encrypt passwords.

You can create a new user like that:

user::create([
  'username' => 'myusername',
  'password' => 'verysecurepassword',
  'role'     => 'visitor',
  'email'    => '...',
  ...
]);

Kirby will make sure to encrypt the password for you.
Like the email field, you can define as many additional fields as you need.

Thank you so much i will try =)

Your method is working but after ill get errors in Users tab.
Btw i use this and its working perfectly;

$user = $site->users()->create(array(
    'username'  => 'john',
    'email'     => 'john@doe.com',
    'password'  => 'secretpasswordwillbeencrypted',
    'firstName' => 'John',
    'lastName'  => 'Doe'
  ));
1 Like

Yes, the name fields are required if you want to manage the users in the Panel. Great that it’s working now.

PS: Please use Markdown code blocks when posting code in the forum. They use three backticks at the start and end on separate lines. I have changed it for you above.

1 Like