Documentation > CMS Template API Library > User > IsInGroup(String)

IsInGroup

Used to tell if the user belongs to the specified group name.

public System.Boolean IsInGroup(String)


Returns

Returns true if the user belongs to the specified group.

Parameters

NameDescriptionType
groupName The name of the group to be checked. System.String

Code Example

C#

Sample:

            User theUser = User.Load("usersname");
            bool isInGroup = user.IsInGroup("groupname");
            if (isInGroup)
              Out.WriteLine("The user " + theUser.Username + " belongs to the group called groupname.");
            

Connect with Crownpeak