]> gitweb.fluxo.info Git - drupal/reminder.git/commitdiff
More reminder_subscriptions fixes
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 5 Nov 2012 19:30:13 +0000 (17:30 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 5 Nov 2012 19:30:13 +0000 (17:30 -0200)
reminder.install
reminder.module

index 395838ae8ebd718af4f8383ee61cfbeea3254170..2c7df593bf22cf980420d34f59f68db3fca74f5b 100644 (file)
@@ -94,7 +94,7 @@ function reminder_schema() {
       ),
       'unsubscribe_url' => array(
         'type' => 'varchar',
-        'length' => 25,
+        'length' => 30,
         'not null' => TRUE,
         'default' => ''
       ),
@@ -207,3 +207,17 @@ function reminder_update_7002(&$sandbox) {
     )
   );
 }
+
+/**
+ * Increase unsubscribe_url size.
+ */
+function reminder_update_7003(&$sandbox) {
+  db_change_field('reminder_subscriptions', 'unsubscribe_url', 'unsubscribe_url',
+      array(
+        'type'     => 'varchar',
+        'length'   => 30,
+        'not null' => TRUE,
+        'default'  => ''
+        )
+      );
+}
index 4a22a212011437ab5f363a176816a76389304a3f..b3a550a01fe4f2264db3bc3502bc8f987a267c91 100644 (file)
@@ -263,6 +263,7 @@ function reminder_validate($node, $form, &$form_state) {
  *   Date, remind and subscribe widgets.
  *   Update subscribers, removing old ones.
  *   Optionally send unsubscription email for removed users.
+ *   Redirect to reminder page.
  */
 function reminder_node_submit($node, $form, &$form_state) {
   global $user;
@@ -318,9 +319,9 @@ function reminder_node_submit($node, $form, &$form_state) {
         'reminder_id'     => $node->nid,
         'unsubscribe_url' => $unsubscribe_url,
       );
-    }
 
-    $query = db_insert('reminder_subscriptions')->fields($values);
+      $query = db_insert('reminder_subscriptions')->fields($values)->execute();
+    }
   }
   else {
     // Fetch existing options.
@@ -410,15 +411,8 @@ function reminder_node_submit($node, $form, &$form_state) {
  * @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);
+   $subject             = t('Reminder information');
+   $body                = t('Reminder URL: @url', array('@url' => $params['reminder_url']));
    $message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
    $message['body'][]   = drupal_html_to_text($body);