public function GroupMembership::revokeRoles in Group 7
Revoke roles from a membership.
This is merely a helper function that sets the 'roles' property and then saves the GroupMembership. The actual business logic can be found in GroupMembershipController::save().
Parameters
array $roles: (optional) A list of role names to revoke. Will revoke all roles from the group membership if left blank.
See also
GroupMembershipController::save()
File
- classes/
group_membership.inc, line 65 - Defines the Entity API class for group memberships.
Class
- GroupMembership
- Main class for group memberships.
Code
public function revokeRoles(array $roles = array()) {
// Update the membership's roles property.
$this->roles = empty($roles) ? array() : array_diff($this->roles, $roles);
// Save the membership so the roles are actually revoked.
$this
->save();
}