You are here

function simplenews_rules_map_confirmation in Simplenews 7

Same name and namespace in other branches
  1. 8.2 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_map_confirmation()
  2. 8 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_map_confirmation()
  3. 7.2 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_map_confirmation()
  4. 3.x simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_map_confirmation()

Map args to the confrmation argument for subscribing/unsubscribing.

2 calls to simplenews_rules_map_confirmation()
simplenews_rules_action_subscribe in simplenews_rules/simplenews_rules.rules.inc
Action Implementation: Subscribe an e-mail adress to a Simplenews newsletter.
simplenews_rules_action_unsubscribe in simplenews_rules/simplenews_rules.rules.inc
Action Implementation: Unsubscribe an e-mail adress to a Simplenews newsletter.

File

simplenews_rules/simplenews_rules.rules.inc, line 249
Rules hooks for the Simplenews newsletter module.

Code

function simplenews_rules_map_confirmation($args) {
  switch ($args['confirmation']) {
    case SIMPLENEWS_RULES_CONFIRMATION_YES:
      $confirmation = TRUE;
      break;
    case SIMPLENEWS_RULES_CONFIRMATION_NO:
      $confirmation = FALSE;
      break;
    case SIMPLENEWS_RULES_CONFIRMATION_DEFAULT:
      $account = simplenews_load_user_by_mail($args['mail']);
      $confirmation = simplenews_require_double_opt_in($args['tid'], $account);
      break;
  }
  return $confirmation;
}