UserGroupsVariable

Type
Class
Namespace
Craft
Inherits
Craft\UserGroupsVariable
Since
1.0

User group functions.

See also http://craftcms.com

View source

Public Methods

MethodDescription
getAllGroups()Returns all user groups.
getAssignableGroups()Returns the user groups that the current user is allowed to assign to another user.
getGroupByHandle()Gets a user group by its handle.
getGroupById()Gets a user group by its ID.

getAllGroups()

Returns all user groups.

View source

Arguments

Returns

Craft\UserGroupModel[]

Signature

public Craft\UserGroupModel[] getAllGroups ( $indexBy = null )

getAssignableGroups()

Returns the user groups that the current user is allowed to assign to another user.

View source

Arguments

  • $user (Craft\UserModel, null) – The recipient of the user groups. If set, their current groups will be included as well.

Returns

Craft\UserGroupModel[]

Signature

public Craft\UserGroupModel[] getAssignableGroups ( Craft\UserModel $user = null )

getGroupByHandle()

Gets a user group by its handle.

View source

Arguments

Returns

Craft\UserGroupModel, null

Signature

public Craft\UserGroupModel, null getGroupByHandle ( $groupHandle )

getGroupById()

Gets a user group by its ID.

View source

Arguments

Returns

Craft\UserGroupModel, null

Signature

public Craft\UserGroupModel, null getGroupById ( $groupId )