Plugin
This section will go over how to use the plugin that comes with the Users module.
user
The user
function returns a decorated user instance from the identifier provided.
Returns: \Anomaly\UsersModule\User\UserPresenter
or null
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$identifier |
false |
mixed |
Will return the active user. |
The id, email, or username of the user to return. |
Twig
Hello {{ user().display_name }}
Sup {{ user('ryanthepyro').first_name }}
role
The role
method returns a decorated role instance from the identifier provided.
Returns: \Anomaly\UsersModule\Role\RolePresenter
or null
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$identifier |
true |
mixed |
none |
The ID or slug of the role to return. |
Example
{% if role('user').hasPermission('example.module.test::example.test') %}
{# Do something #}
{% endif %}