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 |
For the $props
parameter, you pass an array with the following data, which will be used to set up the Kirby\Cms\User
object:
Name | Type | Description |
---|---|---|
blueprint | array |
Sets the Blueprint object |
content | array |
Sets the Content object |
string |
Sets the user email | |
files | array |
Sets the Files collection |
id | string |
Sets the user id |
language | string |
Sets the user language |
name | string |
Sets the user name |
password | string |
Sets the user's password hash |
role | string |
Sets the user role |
translations | array |
Create the translations collection from an array |
Return type
Parent class
Example
$newUser = User::create([
'email' => 'bastian@getkirby.com',
'name' => 'Bastian',
'role' => 'admin',
'language' => 'en',
'password' => 'topSecret',
'content' => [
'twitter' => '@getkirby',
'position' => 'founder'
]
]);