You are here

function party_user_sync_form_submit in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_user/party_user.admin.inc \party_user_sync_form_submit()

File

modules/party_user/party_user.admin.inc, line 136
Provide config forms for views

Code

function party_user_sync_form_submit($form, &$form_state) {

  // Get all Users
  $users = db_select('users', 'u')
    ->fields('u', array(
    'uid',
    'name',
  ))
    ->condition('uid', 0, '<>')
    ->execute()
    ->fetchAllAssoc('uid', PDO::FETCH_ASSOC);
  $batch = array(
    'operations' => array(),
    'finished' => 'party_user_sync_finished',
    'title' => t("Processing User Sync"),
    'init_message' => t('User Sync is starting'),
    'progress_message' => t('Processed @current out of @total'),
    'error_message' => t('User Sync Encountered an Error'),
    'file' => drupal_get_path('module', 'party_user') . '/party_user.batch.inc',
  );
  foreach ($users as $user) {
    $batch['operations'][] = array(
      'party_user_batch_user_sync',
      array(
        $user,
        array(),
      ),
    );
  }
  batch_set($batch);
  $form_state['redirect'] = 'admin/config/party/user/sync';
}