You are here

function protected_pages_mail in Protected Pages 7

Same name and namespace in other branches
  1. 8 protected_pages.module \protected_pages_mail()
  2. 7.2 protected_pages.module \protected_pages_mail()

Implements hook_mail().

File

./protected_pages.module, line 189
This module allows you to protect any page of your website by secure password. You can enter urls of pages to protect and set password per page. Admin (uid = 1) or user with bypass protection permission can view page.

Code

function protected_pages_mail($key, &$message, $params) {
  switch ($key) {
    case 'protected_pages_details_mail':
      $tokens = array(
        '[protected-page-url]',
        '[site-name]',
      );
      $replcements = array(
        $params['protected_page_url'],
        check_plain(variable_get('site_name', '')),
      );
      $body = str_replace($tokens, $replcements, $params['body']);
      $subject = $params['subject'];
      $message['subject'] = $subject;
      $message['body'][] = $body;
      break;
  }
}