You are here

function mass_contact_user in Mass Contact 5

Same name and namespace in other branches
  1. 5.2 mass_contact.module \mass_contact_user()
  2. 6 mass_contact.module \mass_contact_user()

Implementation of hook_user().

Provide form element to opt in to content mailouts.

File

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

Code

function mass_contact_user($type, $edit, &$user, $category = NULL) {
  if (variable_get('mass_contact_optout_d', 1) == 1) {
    if ($type == 'register' || $type == 'form' && $category == 'account') {
      $form['mail'] = array(
        '#type' => 'fieldset',
        '#title' => t('Group e-mail settings'),
        '#weight' => 5,
        '#collapsible' => TRUE,
      );
      $form['mail']['mass_contact_optout'] = array(
        '#type' => 'checkbox',
        '#title' => t('Opt-out of Mass E-mails'),
        '#default_value' => $edit['mass_contact_optout'],
        '#description' => t('Allows you to opt-out of group e-mails from privileged users. Note that site administrators are able to include you in mass e-mails even if you choose not to enable this feature, and the ability to opt-out may be removed by the administrator at any time.'),
      );
      return $form;
    }
    elseif ($type == 'validate') {
      return array(
        'mass_contact_optout' => $edit['mass_contact_optout'],
      );
    }
  }
}