domain_form_user_admin_account_alter

Versions
domain
domain_form_user_admin_account_alter(&$form, $form_state)

Implement hook_form_alter().

Code

./domain.module, line 477

<?php
function domain_form_user_admin_account_alter(&$form, $form_state) {
  if (!user_access('assign domain editors')) {
    return;
  }
  $options = array();
  $format = domain_select_format();
  foreach (domain_domains() as $data) {
    // Cannot pass zero in checkboxes.
    ($data['domain_id'] == 0) ? $key = -1 : $key = $data['domain_id'];
    // The domain must be valid.
    if ($data['valid'] || user_access('access inactive domains')) {
      // Filter checkbox output but not select list.
      $options[$key] = empty($format) ? check_plain($data['sitename']) : $data['sitename'];
    }
  }
  $form['domain'] = array(
    '#type' => 'fieldset',
    '#title' => t('Affiliate editor options'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#prefix' => '<div class="description">'. t('If you select <em>Assign users to domains</em> above, you should confirm the <em>Affiliate editor options</em> settings below.') .'</div>',
    '#weight' => -1,
  );
  $form['domain']['domains'] = array(
    '#type' => empty($format) ? 'checkboxes' : 'select',
    '#title' => t('Assign to'),
    '#options' => $options,
    '#required' => FALSE,
    '#description' => t('Select which affiliates these users should belong to. <em>Note: this will erase any current assignment for the selsected users.</em>'),
    '#default_value' => array(($_domain['domain_id'] == 0) ? -1 : $_domain['domain_id']), // Can't use 0 as a checkbox value.
  );
  if ($format) {
    $form['domain']['domains']['#multiple'] = TRUE;
    $form['domain']['domains']['#size'] = count($options) > 10 ? 10 : count($options);
  }
  // Add our domain elements.
  foreach (array_keys($form['name']) as $uid) {
    $form['user_domains'][$uid][0] = array('#value' => theme('item_list', _domain_user_list($uid)));
  }
  $form['#theme'] = 'domain_admin_users_form';
  $form['#submit'][] = 'domain_update_users';
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List