class User implements ExtenderInterface

Methods

displayNameDriver(string $identifier, string $driver)

<p>Add a display name driver.</p>

permissionGroups(callable|string $callback)

<p>Dynamically process a user's list of groups when calculating permissions.</p>

registerPreference(string $key, callable $transformer = null, $default = null)

<p>Register a new user preference.</p>

extend(Container $container, Extension $extension = null)

No description

Details

displayNameDriver(string $identifier, string $driver)

<p>Add a display name driver.</p>

Parameters

string $identifier <p>Identifier for display name driver. E.g. 'username' for UserNameDriver</p>
string $driver <p>::class attribute of driver class, which must implement Flarum\User\DisplayName\DriverInterface</p>

permissionGroups(callable|string $callback)

<p>Dynamically process a user's list of groups when calculating permissions.</p>

<p>This can be used to give a user permissions for groups they aren't actually in, based on context. It will not change the group badges displayed for the user.</p>

Parameters

callable|string $callback <p>The callable can be a closure or invokable class, and should accept:</p> <ul> <li>\Flarum\User\User $user: the user in question.</li> <li>array $groupIds: an array of ids for the groups the user belongs to.</li> </ul> <p>The callable should return:</p> <ul> <li>array $groupIds: an array of ids for the groups the user belongs to.</li> </ul>

registerPreference(string $key, callable $transformer = null, $default = null)

<p>Register a new user preference.</p>

Parameters

string $key
callable $transformer
$default

extend(Container $container, Extension $extension = null)

Parameters

Container $container
Extension $extension