You are here

function _account_sync_edit_roles in Account Sync 6

Same name and namespace in other branches
  1. 7.2 account_sync.receiver.inc \_account_sync_edit_roles()

Helper to convert the $account role format into the $edit role format.

1 call to _account_sync_edit_roles()
account_sync_update_user in ./account_sync.receiver.inc
XMLRPC callback to update the user account on /this/ drupal site.

File

./account_sync.receiver.inc, line 120
Handler inc for receiving and updating user account data.

Code

function _account_sync_edit_roles($all_roles, $new_roles, $existing_roles) {
  $edit_roles = _account_sync_roles($all_roles, $new_roles, $existing_roles);

  // The roles in the edit array is in a format that's not useful to us
  // So we need to rebuild it based on the $account['roles'] array.
  $roles = array();
  foreach (array_keys($edit_roles) as $rid) {
    $roles[$rid] = $rid;
  }
  return $roles;
}