You are here

function mass_contact_admin_edit in Mass Contact 5

Same name and namespace in other branches
  1. 5.2 mass_contact.module \mass_contact_admin_edit()
  2. 6 mass_contact.module \mass_contact_admin_edit()
  3. 7 mass_contact.admin.inc \mass_contact_admin_edit()

Category edit page.

1 string reference to 'mass_contact_admin_edit'
mass_contact_menu in ./mass_contact.module
Implementation of hook_menu().

File

./mass_contact.module, line 124
Enables mass contact form to selected roles.

Code

function mass_contact_admin_edit($cid = NULL) {
  if (arg(3) == "edit" && $cid > 0) {
    $edit = db_fetch_array(db_query("SELECT * FROM {mass_contact} WHERE cid = %d", $cid));
  }
  $form['category'] = array(
    '#type' => 'textfield',
    '#title' => t('Category'),
    '#maxlength' => 255,
    '#default_value' => $edit['category'],
    '#description' => t("Will appear in the subject of your email as [category]."),
    '#required' => TRUE,
  );

  // get all roles except anonymous
  $allroles = db_query('SELECT rid, name FROM {role} WHERE rid > 1');
  while ($roleobj = db_fetch_object($allroles)) {
    $onerid = $roleobj->rid;
    $onename = $roleobj->name;
    $rolesarray[$onerid] = $onename;
  }
  $form['recipients'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Roles to receive email'),
    '#options' => $rolesarray,
    '#default_value' => explode(',', $edit['recipients']),
    '#description' => t('These roles will be added to the mailing list.	Note: if you check "authenticated users", other roles will not be added, as they will receive the email anyway.'),
  );
  $form['selected'] = array(
    '#type' => 'select',
    '#title' => t('Selected'),
    '#options' => array(
      '0' => t('No'),
      '1' => t('Yes'),
    ),
    '#default_value' => $edit['selected'],
    '#description' => t('Set this to <em>Yes</em> if you would like this category to be selected by default.'),
  );
  $form['cid'] = array(
    '#type' => 'value',
    '#value' => $edit['cid'],
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}