function party_user_sync_form_submit in Party 7
Same name and namespace in other branches
- 8.2 modules/party_user/party_user.admin.inc \party_user_sync_form_submit()
File
- modules/
party_user/ party_user.admin.inc, line 123 - Provide config forms for views
Code
function party_user_sync_form_submit($form, &$form_state) {
// Get all Users
$query = db_select('users', 'u')
->fields('u', array(
'uid',
'name',
))
->condition('uid', 0, '<>');
$query
->leftJoin('party_attached_entity', 'pae', '%alias.data_set = :data_set AND %alias.eid = u.uid', array(
':data_set' => 'user',
));
$query
->isNull('pae.pid');
$users = $query
->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';
}