class User implements ExtenderInterface

Methods

displayNameDriver(string $identifier, string $driver)

Add a display name driver.

avatarDriver(string $identifier, string $driver)

Add an avatar driver.

permissionGroups(callable|string $callback)

Dynamically process a user's list of groups when calculating permissions.

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

Register a new user preference.

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

No description

Details

User displayNameDriver(string $identifier, string $driver)

Add a display name driver.

Parameters

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

Return Value

User

User avatarDriver(string $identifier, string $driver)

Add an avatar driver.

Parameters

string $identifier : Identifier for avatar driver. E.g. 'gravatar' for GravatarDriver
string $driver : ::class attribute of driver class, which must implement Flarum\User\Avatar\DriverInterface

Return Value

User

User permissionGroups(callable|string $callback)

Dynamically process a user's list of groups when calculating permissions.

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.

Parameters

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

Return Value

User

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

Register a new user preference.

Parameters

string $key
callable|null $transformer
mixed $default

Return Value

User

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

Parameters

Container $container
Extension|null $extension

Return Value

void