Skip to content

Kirby 5.1.2

$auth->impersonate()

Become any existing user or disable the current user

$auth->impersonate(string|null $who = null): Kirby\Cms\User|null

Parameters

Name Type Default Description
$who stringornull null User ID or email address,
null to use the actual user again,
'kirby' for a virtual admin user or
'nobody' to disable the actual user

Return types

Kirby\Cms\Userornull

This method modifies the existing $auth object it is applied to and returns it again.

Exceptions

Type Description
Kirby\Exception\NotFoundException if the given user cannot be found

Parent class

Kirby\Cms\Auth