You are here

function og_ui_user_multiple_role_edit in Organic groups 7

Callback function for admin mass adding/ deleting a user role.

1 string reference to 'og_ui_user_multiple_role_edit'
og_ui_og_user_operations in og_ui/og_ui.module
Implement hook_og_user_operations().

File

og_ui/og_ui.module, line 638
Organic groups UI.

Code

function og_ui_user_multiple_role_edit($gid, $accounts, $operation, $rid) {
  switch ($operation) {
    case 'add_role':
      $accounts = user_load_multiple($accounts);
      foreach ($accounts as $account) {
        og_role_grant($gid, $account->uid, $rid);
      }
      break;
    case 'remove_role':
      $accounts = user_load_multiple($accounts);
      foreach ($accounts as $account) {
        og_role_revoke($gid, $account->uid, $rid);
      }
      break;
  }
}