Reference

Guide

$user->update()

Updates the model data

$user->update(array $input = null, string $languageCode = null, bool $validate = false): Kirby\Cms\User

Parameters

Name Type Default Description
$input array null
$languageCode string null
$validate bool false

Return type

Kirby\Cms\User

Example

try {

  $kirby->user('bastian@example.com')->update([
    'email'     => 'bastian@getkirby.com',
    'firstName' => 'Bastian',
    'lastName'  => 'Allgeier'
  ]);

  echo 'The user has been updated';

} catch(Exception $e) {

  echo 'The user could not be updated';
  // optional reason: echo $e->getMessage();

}

Inherited from

Kirby\Cms\ModelWithContent

Source code

kirby/src/Cms/ModelWithContent.php#L675