member_of

Summary

Fetches the roles that are assigned to a user.

Usage

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

Parameters

NameTypeDescriptionRequired
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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.