From f1cb18689fa72016f98b2bd22020f0aa42404409 Mon Sep 17 00:00:00 2001
From: Ward Poelmans <wpoely86@gmail.com>
Date: Sat, 4 Feb 2012 14:34:54 +0100
Subject: [PATCH 1/5] Fixed the configure url

---
 notify.info |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notify.info b/notify.info
index 58b049e..0531b6e 100644
--- a/notify.info
+++ b/notify.info
@@ -4,4 +4,4 @@ package = Mail
 core = 7.x
 files[] = notify.install
 files[] = notify.module
-configure = admin/config/notify
+configure = admin/config/people/notify
-- 
1.7.7.6


From f163b6edef0b6845b332ba5063032d02d3481783 Mon Sep 17 00:00:00 2001
From: Ward Poelmans <wpoely86@gmail.com>
Date: Sat, 4 Feb 2012 14:38:42 +0100
Subject: [PATCH 2/5] Fixed SQL bug

---
 notify.module |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/notify.module b/notify.module
index 2e2a13c..dc8889f 100644
--- a/notify.module
+++ b/notify.module
@@ -636,9 +636,6 @@ function _notify_send($send_start = NULL) {
     $q->condition('n.status', 1);
     $q->condition('u.status', 1);
     $q->condition('n.attempts', variable_get('notify_attempts', 5), '<=');
-    if (count($ntype) >= 1) {
-      $q->condition('n.type', $ntype, 'IN');
-    }
     $uresult = $q->execute();
 
     foreach ($uresult as $user) {
-- 
1.7.7.6


From 1e9cbe78c3ab192248e25ebdf213306f42d1c3aa Mon Sep 17 00:00:00 2001
From: Ward Poelmans <wpoely86@gmail.com>
Date: Sun, 5 Feb 2012 21:05:00 +0100
Subject: [PATCH 3/5] Temporarily fix to show username and email on form

This might have sometime to do with http://drupal.org/node/1261040
---
 notify.module |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/notify.module b/notify.module
index dc8889f..008914f 100644
--- a/notify.module
+++ b/notify.module
@@ -151,7 +151,6 @@ function notify_user_cancel($edit, $account, $method) {
  * Implements hook_form_FORM_ID_alter()
  */
 function notify_form_user_register_form_alter(&$form, &$form_state, $form_id) {
-  dpm($form);
   $form += _notify_user_reg_fields();
 }
 
@@ -413,13 +412,17 @@ function notify_admin_users($form, &$form_state) {
 
   foreach ($uresult as $user) {
     $form['users'][$user->uid] = array();
+    // temporarily fix. type markup does not show anything?
     $form['users'][$user->uid]['name'] = array(
-      '#type' => 'markup',
-      '#value' => theme('username', array('account' => $user)),
+      '#type' => 'textfield',
+      '#disabled' => TRUE,
+      '#default_value' => $user->name,
     );
+    // temporarily fix. type markup does not show anything?
     $form['users'][$user->uid]['mail'] = array(
-      '#type' => 'markup',
-      '#value' => $user->mail,
+      '#type' => 'textfield',
+      '#disabled' => TRUE,
+      '#default_value' => $user->mail,
     );
     $form['users'][$user->uid]['node'] = array(
       '#type' => 'checkbox',
-- 
1.7.7.6


From cfa773a5308adf2e598158eaacf26f938577c9d7 Mon Sep 17 00:00:00 2001
From: Ward Poelmans <wpoely86@gmail.com>
Date: Thu, 9 Feb 2012 11:03:40 +0100
Subject: [PATCH 4/5] Made all strings translatable

---
 notify.module |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/notify.module b/notify.module
index 008914f..4e06036 100644
--- a/notify.module
+++ b/notify.module
@@ -63,37 +63,37 @@ function notify_admin_settings($form, &$form_state) {
 
   $form['notify_settings']['notify_send'] = array(
     '#type' => 'select',
-    '#title' => 'Send notifications every',
+    '#title' => t('Send notifications every'),
     '#default_value' => variable_get('notify_send', array(86400)),
     '#options' => $period,
-    '#description' => 'How often should new content notifications be sent? Requires cron to be running at least this often.',
+    '#description' => t('How often should new content notifications be sent? Requires cron to be running at least this often.'),
   );
 
   $form['notify_settings']['notify_send_hour'] = array(
     '#type' => 'select',
-    '#title' => 'Hour to Send Notifications',
-    '#description' => 'Specify the hour (24-hour clock) in which notifications should be sent, if the frequency is one day or greater.',
+    '#title' => t('Hour to Send Notifications'),
+    '#description' => t('Specify the hour (24-hour clock) in which notifications should be sent, if the frequency is one day or greater.'),
     '#default_value' => variable_get('notify_send_hour', 9),
     '#options' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23),
   );
 
   $form['notify_settings']['notify_attempts'] = array(
     '#type' => 'select',
-    '#title' => 'Number of failed sends after which notifications are disabled',
+    '#title' => t('Number of failed sends after which notifications are disabled'),
     '#default_value' => variable_get('notify_attempts', array(5)),
     '#options' => array(t('Disabled'), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20),
   );
 
   $form['notify_settings']['notify_reg_default'] = array(
     '#type' => 'checkbox',
-    '#title' => 'Notification checkbox default on new user registration form',
+    '#title' => t('Notification checkbox default on new user registration form'),
     '#return_value' => 1,
     '#default_value' => variable_get('notify_reg_default', 1),
   );
 
   $form['notify_settings']['notify_include_updates'] = array(
     '#type' => 'checkbox',
-    '#title' => 'Include updated posts in notifications',
+    '#title' => t('Include updated posts in notifications'),
     '#return_value' => 1,
     '#default_value' => variable_get('notify_include_updates', 1),
   );
@@ -101,10 +101,10 @@ function notify_admin_settings($form, &$form_state) {
   $set = 'ntype';
   $form[$set] = array(
     '#type' => 'fieldset',
-    '#title' => 'Notification by node type',
+    '#title' => t('Notification by node type'),
     '#collapsible' => TRUE,
     '#collapsed' => FALSE,
-    '#description' => 'Having nothing checked defaults to sending notifications about all node types.',
+    '#description' => t('Having nothing checked defaults to sending notifications about all node types.'),
   );
 
   foreach (node_type_get_types() as $type => $object) {
@@ -195,7 +195,7 @@ function _notify_user_reg_fields() {
   // Add the checkbox to the fieldset
   $fields['notify_agree']['notify_decision'] = array(
     '#type' => 'checkbox',
-    '#title' => t('Receive email notifications of new content posted to this site. Notifications are sent every ' . format_interval($period) . '.'),
+    '#title' => t('Receive email notifications of new content posted to this site. Notifications are sent every @interval.', array('@interval' => format_interval($period))),
     '#return_value' => 1,
     '#default_value' => variable_get('notify_reg_default', 1),
   );
@@ -211,11 +211,11 @@ function notify_permission() {
   return array(
     'access notify' => array(
       'title' => t('access notify'),
-      'description' => t('TODO Add a description for \'access notify\''),
+      'description' => t('Allow user to setup and receive notifications when there is new content'),
     ),
     'administer notify' => array(
       'title' => t('administer notify'),
-      'description' => t('TODO Add a description for \'administer notify\''),
+      'description' => t('Administer the notify module'),
     ),
   );
 }
@@ -229,8 +229,8 @@ function notify_menu() {
   $items = array();
 
   $items['admin/config/people/notify'] = array(
-    'title' => 'Notification settings',
-    'description' => 'Adjust settings for new content notifications sent by e-mail.',
+    'title' => t('Notification settings'),
+    'description' => t('Adjust settings for new content notifications sent by e-mail.'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('notify_admin_settings'),
     'access callback' => 'user_access',
@@ -238,12 +238,12 @@ function notify_menu() {
     'type' => MENU_NORMAL_ITEM,
   );
   $items['admin/config/people/notify/settings'] = array(
-    'title' => 'Settings',
+    'title' => t('Settings'),
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -10,
   );
   $items['admin/config/people/notify/users'] = array(
-    'title' => 'Users',
+    'title' => t('Users'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('notify_admin_users'),
     'access callback' => 'user_access',
@@ -251,7 +251,7 @@ function notify_menu() {
     'type' => MENU_LOCAL_TASK,
   );
   $items['user/%user/notify'] = array(
-    'title' => 'Notification settings',
+    'title' => t('Notification settings'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('notify_user_settings_form', 1),
     'access callback' => 'notify_user_access',
-- 
1.7.7.6


From afb673a58e4c46dfb25168297fe70990935179cb Mon Sep 17 00:00:00 2001
From: Ward Poelmans <wpoely86@gmail.com>
Date: Thu, 9 Feb 2012 12:28:45 +0100
Subject: [PATCH 5/5] Made it possible to also add the contents of fields to
 an email

Previously, when you select 'Full', only the the body of the node is
mailed and all the fields attached to the node bundle are ignored. Now
there is an option to also include all the fields in the mail.
---
 README.txt    |    3 ++-
 notify.module |   20 +++++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/README.txt b/README.txt
index 97e717c..62868a0 100644
--- a/README.txt
+++ b/README.txt
@@ -51,7 +51,8 @@ Rob Barreca <rob@electronicinsight.com> was a previous maintainer.
 
 Matt Chapman <matt@ninjitsuweb.com> is the current maintainer.
 
-Ishmael Sanchez (http://ishmaelsanchez.com) and
+Ishmael Sanchez (http://ishmaelsanchez.com),
+Ward Poelmans <wpoely86@gmail.com> and
 John Oltman <john.oltman@sitebasin.com> co-developed the Drupal 7 port.
 
 ------------------------
diff --git a/notify.module b/notify.module
index 4e06036..b9900b5 100644
--- a/notify.module
+++ b/notify.module
@@ -309,8 +309,8 @@ function notify_user_settings_form($form, &$form_state, $arg) {
   }
 
   $result = db_query('SELECT u.uid, u.name, u.mail, n.status, n.node, n.teasers, n.comment FROM {users} u LEFT JOIN {notify} n ON u.uid = n.uid WHERE u.uid = :uid AND u.status = :status', array(':uid' => $account->uid, ':status' => 1));
-  foreach ($result as $notify) {
-  }
+  $notify = $result->fetchObject();
+
   $form = array();
   if (!$notify->mail) {
     drupal_set_message(t('Your e-mail address must be specified on your <a href="@url">my account</a> page.', array('@url' => url('user/' . $account->uid . '/edit'))), 'error');
@@ -343,7 +343,7 @@ function notify_user_settings_form($form, &$form_state, $arg) {
     '#type' => 'radios',
     '#title' => t('Content'),
     '#default_value' => $notify->teasers,
-    '#options' => array(t('Title only'), t('Title + Teaser'), t('Title + Body')),
+    '#options' => array(t('Title only'), t('Title + Teaser'), t('Title + Body'), t('Title + Body + Fields')),
     '#description' => t('Select the amount of each post that you would like to see in your notification e-mails.'),
   );
   $form['notify_page_detailed']['comment'] = array(
@@ -431,7 +431,7 @@ function notify_admin_users($form, &$form_state) {
     $form['users'][$user->uid]['teasers'] = array(
       '#type' => 'select',
       '#default_value' => $user->teasers,
-      '#options' => array(t('Title only'), t('Title + Teaser'), t('Title + Body')),
+      '#options' => array(t('Title only'), t('Title + Teaser'), t('Title + Body'), t('Title + Body + Fields')),
     );
     $form['users'][$user->uid]['comment'] = array(
       '#type' => 'checkbox',
@@ -534,7 +534,6 @@ function theme_notify_admin_users($variables) {
  * Formatting of outgoing mail, taken from mail.inc, part of project.module
  */
 function _notify_content($node, $notify) {
-  static $i = 0;
   $txt = '';
 
   switch ($notify->teasers) {
@@ -551,6 +550,17 @@ function _notify_content($node, $notify) {
       if (isset($content['body'][0]['#markup'])) {
         $txt = $content['body'][0]['#markup'];
       }
+      break;
+    case 3:
+      $content = node_view($node,'full');
+      // run of all children so that every attacked field is also included
+      $children = element_children($content, TRUE);
+
+      foreach($children as $child)
+      {
+	  $txt .= drupal_render($content[$child]);
+	  $txt .= '<p> </p>'; // some space between the fields
+      }
   }
 
   return drupal_html_to_text($txt);
-- 
1.7.7.6

