From aabc235e31c028c30c899b495871f47d8719aa3d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 5 Sep 2012 21:47:02 -0300 Subject: Starting to implement hook_mail() --- reminder.module | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/reminder.module b/reminder.module index 0acb74d..60a24ba 100644 --- a/reminder.module +++ b/reminder.module @@ -185,7 +185,7 @@ function reminder_form(&$node) { '#date_format' => isset($reminder['until']) ? $reminder['until'] : $format_until, '#date_label_position' => 'within', '#date_increment' => 60, - '#date_year_range' => '0:+3', + '#date_year_range' => '0:+20', ); $form['frequency'] = array( @@ -384,6 +384,28 @@ function reminder_node_submit($node, $form, &$form_state) { drupal_set_message(t("Saved.")); } +/** + * Implements hook_mail() + * + * @todo + */ +function reminder_mail($key, &$message, $params) { + $account = $params['account']; + $context = $params['context']; + $variables = array( + '%site_name' => variable_get('site_name', 'Drupal'), + '%username' => format_username($account), + ); + + $subject = strtr($context['subject'], $variables); + $body = strtr($context['message'], $variables); + $message['subject'] .= str_replace(array("\r", "\n"), '', $subject); + $message['body'][] = drupal_html_to_text($body); + + if ($key == 'create_new_reminder') { + } +} + /** * Implementation of hook_node_delete() */ @@ -401,7 +423,7 @@ function reminder_delete($node) { * Send periodic emails. */ function reminder_cron() { - variable_set('reminder_cron_last_run', REQUEST_TIME); + variable_set('reminder_cron_last_run', REQUEST_TIME); } /** -- cgit v1.2.3