You are here

function _account_sync_update_roles in Account Sync 7.2

Properly set the roles in the account prior to sending to the receiver.

When updating a user account the roles aren't always properly set to the ($rid => $name) format, but instead ($rid => $rid). This function should correct that issue.

1 call to _account_sync_update_roles()
_account_sync_send_update in ./account_sync.sender.inc
Helper function to do the heavy lifting of the account information transfer.

File

./account_sync.sender.inc, line 85
Handler for sending account data to other sites

Code

function _account_sync_update_roles(&$account) {
  foreach ($account->roles as $rid => $role_name) {
    if (is_numeric($role_name)) {
      $role = user_role_load($rid);
      $account->roles[$rid] = $role->name;
    }
  }
}