Skip to content

Kirby 4.5.0

User::create()

Creates a new User from the given props and returns a new User object

User::create(?array $props = null): Kirby\Cms\User

Parameters

Name Type Default
$props array|null null

Return type

Kirby\Cms\User

Parent class

Kirby\Cms\User

Example

$newUser = User::create([
  'email'     => 'bastian@getkirby.com',
  'name'      => 'Bastian',
  'role'      => 'admin',
  'language'  => 'en',
  'password'  => 'topSecret',
  'content'   => [
    'mastodon'  => 'https://mastodon.social/@getkirby',
    'position'  => 'founder'
  ]
]);