Reference

Guide

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 Description
$props array null

Return type

Kirby\Cms\User

The $props parameter

Property Type Description
blueprint array Blueprint definition
content array Field values
email string
id string
language string
name string
password string
role string
translations array Language codes with subarrays of field values

Example

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

Source code

kirby/src/Cms/UserActions.php#L164