You are here

function og_massadd_massadd_form in Organic Groups Mass Add 6

Same name and namespace in other branches
  1. 7 og_massadd.module \og_massadd_massadd_form()

Mass adding users form

1 string reference to 'og_massadd_massadd_form'
og_massadd_massadd in ./og_massadd.module
Mass adding users tab

File

./og_massadd.module, line 60
The og_massadd module file

Code

function og_massadd_massadd_form(&$form_state, $node) {
  global $user;
  $ogsubs = og_get_subscriptions($user->uid);
  $ogs = array();
  foreach ($ogsubs as $i => $ogsub) {
    if ($ogsub['is_admin'] || $ogsub['nid'] == $node->nid) {
      $ogs[$ogsub['nid']] = $ogsub['title'];
    }
  }
  $form['ogs'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Groups to add the user to'),
    '#options' => $ogs,
    '#default_value' => array(
      $node->nid,
    ),
    '#required' => TRUE,
  );
  $form['massadd'] = array(
    '#type' => 'textarea',
    '#title' => t('List of users to add'),
    '#description' => t('A list of users to add. The contents can either be lines consiting of FIRSTNAME, LASTNAME, EMAIL or FIRSTNAME, LASTNAME, EMAIL, USERNAME or a list of email addresses (one on each line).'),
    '#rows' => 20,
    '#default_value' => '',
  );

  /*
    $form['#attributes'] = array('enctype' => "multipart/form-data");
    $form['massadd_csv'] = array(
      '#type' => 'file',
      '#title' => t('Upload a CSV file of users.'),
      '#description' => t('Upload a CSV file with users to add. We will attempt to autodetect the format. If that fails, FIRSTNAME, LASTNAME, EMAIL is assumed.')
    );
  */
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add users'),
  );
  return $form;
}