You are here

function og_user_roles_action in Organic groups 7.2

File

includes/actions/user_roles.action.inc, line 71

Code

function og_user_roles_action($og_membership, $context) {
  if ($og_membership->entity_type != 'user') {
    return;
  }
  $group_type = $og_membership->group_type;
  $gid = $og_membership->gid;
  foreach ($context['add_roles'] as $rid) {
    og_role_grant($group_type, $gid, $og_membership->etid, $rid);
  }
  foreach ($context['remove_roles'] as $rid) {
    og_role_revoke($group_type, $gid, $og_membership->etid, $rid);
  }
}