Skip to content

Kirby 4.2.0

$appusers->impersonate()

Become any existing user or disable the current user

$appusers->impersonate(?string $who = null, ?Closure $callback = null): mixed|null

Parameters

Name Type Default Description
$who string|null 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
$callback Closure|null null Optional action function that will be run with
the permissions of the impersonated user; the
impersonation will be reset afterwards

Return type

mixed|null

Exceptions

Type Description
Throwable

Parent class

Kirby\Cms\AppUsers