You are here

function account_sync_sync_all in Account Sync 6

Same name and namespace in other branches
  1. 7.2 account_sync.admin.inc \account_sync_sync_all()
1 string reference to 'account_sync_sync_all'
account_sync_settings in ./account_sync.admin.inc
FAPI callback for the admin settings form.

File

./account_sync.admin.inc, line 51
Admin settings for account_sync.

Code

function account_sync_sync_all() {
  module_load_include('inc', 'account_sync', 'account_sync.sender');
  $roles = implode("', '", account_sync_allowed_roles());
  $results = db_query("SELECT ur.uid FROM {role} r LEFT JOIN {users_roles} ur ON r.rid = ur.rid WHERE r.name IN ('%s') ORDER BY ur.uid", $roles);
  while ($account = user_load(db_result($results))) {
    $edit = (array) $account;
    unset($edit['uid']);
    unset($edit['data']);
    if (_account_sync_send_update($edit, $account, 'account')) {
      drupal_set_message(t("Sync'd account information for %username", array(
        '%username' => $account->name,
      )));
    }

    // Send data for the profile categories
    if (module_exists('profile')) {
      $categories = variable_get('account_sync_profile_categories', array());
      foreach ($categories as $category) {
        _account_sync_send_update($edit, $account, $category);
      }
    }
  }
}