You are here

function multiple_email_enable in Multiple E-mail Addresses 5

Same name and namespace in other branches
  1. 6 multiple_email.install \multiple_email_enable()
  2. 7 multiple_email.install \multiple_email_enable()
  3. 2.x multiple_email.install \multiple_email_enable()

Implementation of hook_init()

File

./multiple_email.module, line 33
multiple_email module file

Code

function multiple_email_enable() {

  // Add each variable and its default value to this array
  $vars = array(
    'confirm_deadline' => 5,
    'confirm_attempts' => 3,
    'hide_field' => 1,
  );

  // Specify every message type to have its defaults initialized
  $messages = array(
    'confirmation',
    'expire',
  );
  $parts = array(
    'subject',
    'body',
  );
  foreach ($messages as $type) {
    foreach ($parts as $part) {
      $func = "multiple_email_default_{$part}";
      $vars["{$type}_{$part}"] = $func($type);
    }
  }
  foreach ($vars as $var => $default) {
    $current = variable_get("multiple_email_{$var}", $default);
    variable_set("multiple_email_{$var}", $current);
  }
  drupal_set_message(t("Multiple Email settings are available under !link", array(
    '!link' => l('Administer > Site configuration > Multiple Email Settings ', 'admin/settings/multiple-email/settings'),
  )));
}