Actions

API16

JUserHelper/getUserGroups

From Joomla! Documentation

< API16:JUserHelper
Revision as of 17:36, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Method to get a list of groups a user is in.

[Edit Descripton]

Description:JUserHelper/getUserGroups

Syntax

static getUserGroups($userId)
Parameter Name Default Value Description
$userId $userId The id of the user.

Returns

mixed Array on success, on error.

Defined in

libraries/joomla/user/helper.php

Importing

jimport( 'joomla.user.helper' );

Source Body

public static function getUserGroups($userId)
{
        // Get the user object.
        $user = &JUser::getInstance((int) $userId);
 
        return isset($user->groups) ? $user->groups : array();
}

[Edit See Also] SeeAlso:JUserHelper/getUserGroups

Examples

<CodeExamplesForm />