Create a user in Frontend

How to create a user in frontend?

Allow visitors in blueprint to create a user?

or

Login with “impersonate()” ?

You can either use the Kirby superuser or an existing user to authenticate.

You can find an example of a user signup in this plugin: https://github.com/starckio/Userskit, check out the signup.php controller and template.

Prior to allowing users to sign up, you should define a role and permissions for these users.

1 Like

Thanks!

$kirby->impersonate('kirby');
$user = $kirby->users()->create(array(
	'email'     => $data['email'],
	'name'      => $username,
	'role'      => 'client',
	'language'  => 'de',
	'password'  => $data['password'],
	'content'   => [
		'firstname' => $data['firstname'],
		'lastname'  => $data['lastname'],
		'active'	=> '0',
		'create'	=> time(),
		'token' 	=> $token,
	  ],
	));

Why is the “content” not written to the user file?

There’s a bug in multi-language environments:

Oh, ok. Thanks.

This is now fixed in rc 3.1.2