Skip to the content
Documentation

member_of

No ratings yet

Summary

Fetches the roles that are assigned to a user.

Usage

fetch( 'user', 'member_of', hash( 'id', id ) )

Parameters

Name Type Description Required
id integer The ID number of the target user. Yes.

Returns

An array with ezrole objects or FALSE.

Description

This function will fetch the roles that are assigned to a user. The desired user's ID number must be specified using the "id" parameter. The function will return an array of ezrole objects. If no roles are associated with the user, or if an invalid user ID is provided, the function will return FALSE.

Examples

Example 1

{def $roles=fetch( 'user', 'member_of', hash( 'id', 42 ) )}

{foreach $roles as $role}
    {$role.name} <br />
{/foreach}

Outputs the names of the roles that are assigned to user number 42.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.