Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/README.txt,v
retrieving revision 1.11.2.4
diff -u -p -r1.11.2.4 README.txt
--- README.txt	23 Jan 2010 10:28:20 -0000	1.11.2.4
+++ README.txt	23 Jan 2010 16:59:49 -0000
@@ -1,4 +1,4 @@
-$Id: README.txt,v 1.11.2.4 2010/01/23 10:28:20 sutharsan Exp $
+$Id: README.txt,v 1.11.2.3 2010/01/04 05:44:17 sutharsan Exp $
 
 DESCRIPTION
 -----------
@@ -140,12 +140,27 @@ INSTALLATION
     'Send mail' options at:
       Administer > Site configuration > Simplenews > Send mail.
 
- 11. TIPS
+ 11. (UN)SUBSCRIBE CONFIRMATION
+ 
+    By default the unsubscribe link will direct the user to a confirmation page.
+    Upon confirmation the user is directed to the home page, where a message
+    will be displayed. On the Simplenews subscription admin page you can
+    specify an alternative destination page.
+      Administer > Site configuration > Simplenews > Subscription
+    To skip the confirmation page you can add parameters to the subscription URL.
+      Example: [simplenews-subscribe-url]/ok
+    When an alternative destination page has been defined the extra parameters
+    will be added to the destination URL.
+      Example: [simplenews-subscribe-url]/ok
+      Destination: node/123
+      Destination URL: node/123/ok
+
+ 12. TIPS
 
     A subscription page is available at: /newsletter/subscriptions
     
     If your unsubscribe URL looks like:
-      http:///newsletter/confirm/remove/8acd182182615t632
+      http://newsletter/confirm/remove/8acd182182615t632
     instead of:
       http://www.mysite.org/newsletter/confirm/remove/8acd182182615t632
     You should change the base URL in the settings.php file from
Index: simplenews.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/simplenews.admin.inc,v
retrieving revision 1.59.2.5
diff -u -p -r1.59.2.5 simplenews.admin.inc
--- simplenews.admin.inc	23 Jan 2010 10:28:20 -0000	1.59.2.5
+++ simplenews.admin.inc	23 Jan 2010 16:59:50 -0000
@@ -1056,6 +1056,24 @@ function simplenews_admin_settings_subsc
     '#rows' => 5,
   );
 
+  $form['simplenews_subscription']['confirm_pages'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Confirmation pages'),
+    '#collapsible' => FALSE,
+  );
+  $form['simplenews_subscription']['confirm_pages']['simplenews_confirm_subscribe_page'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Subscribe confirmation'),
+    '#description' => t('Drupal path or URL of the destination page where after the subscription is confirmed (e.g. node/123). Leave empty to go to the front page.'),
+    '#default_value' => variable_get('simplenews_confirm_subscribe_page', ''),
+  );
+  $form['simplenews_subscription']['confirm_pages']['simplenews_confirm_unsubscribe_page'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Unsubscribe confirmation'),
+    '#description' => t('Drupal path or URL of the destination page when the subscription removal is confirmed (e.g. node/123). Leave empty to go to the front page.'),
+    '#default_value' => variable_get('simplenews_confirm_unsubscribe_page', ''),
+  );
+  
   return system_settings_form($form);
 }
 
Index: simplenews.subscription.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/simplenews.subscription.inc,v
retrieving revision 1.13
diff -u -p -r1.13 simplenews.subscription.inc
--- simplenews.subscription.inc	30 Jul 2009 19:56:47 -0000	1.13
+++ simplenews.subscription.inc	23 Jan 2010 16:59:51 -0000
@@ -92,12 +92,16 @@ function simplenews_subscription_manager
  *
  * This function is called by clicking the confirm link in the confirmation
  * email or the unsubscribe link in the footer of the newsletter. It handles
- * both subscription and unsubscription.
+ * both subscription addition and subscription removal.
  *
  * @see simplenews_confirm_add_form()
  * @see simplenews_confirm_removal_form()
  */
-function simplenews_confirm_subscription($op1 = NULL, $op2 = NULL) {
+function simplenews_confirm_subscription() {
+  $arguments = func_get_args();
+  $op1 = array_shift($arguments);
+  $op2 = array_shift($arguments);
+
   $md5 = drupal_substr($op2, 0, 10);
   list($snid, $tid) = explode('t', drupal_substr($op2, 10));
 
@@ -109,11 +113,37 @@ function simplenews_confirm_subscription
 
   if ($md5 == drupal_substr(md5($subs->mail . simplenews_private_key()), 0, 10)) {
     $newsletter = taxonomy_get_term($tid);
-    if ($op1 == 'remove') {
-      return drupal_get_form('simplenews_confirm_removal_form', $subs->mail, $newsletter);
+    // The confirmation page called with two arguments will display a confirmation question.
+    // When called with three of more arguments the user will be directed to the
+    // (un)subscribe confirmation page. The additional arguments will be passed on
+    // to the confirmation page.
+    if (empty($arguments)) {
+      if ($op1 == 'remove') {
+        return drupal_get_form('simplenews_confirm_removal_form', $subs->mail, $newsletter);
+      }
+      elseif ($op1 == 'add') {
+        return drupal_get_form('simplenews_confirm_add_form', $subs->mail, $newsletter);
+      }
     }
-    elseif ($op1 == 'add') {
-      return drupal_get_form('simplenews_confirm_add_form', $subs->mail, $newsletter);
+    else {
+      if ($op1 == 'remove') {
+        simplenews_unsubscribe_user($subs->mail, $tid, FALSE, 'website');
+        if ($path = variable_get('simplenews_confirm_unsubscribe_page', '')) {
+          $path = $path .'/'. implode('/', $arguments);
+          drupal_goto($path);
+        }
+        drupal_set_message(t('%user was unsubscribed from the %newsletter mailing list.', array('%user' => $subs->mail, '%newsletter' => $newsletter->name)));
+        drupal_goto(variable_get('site_frontpage', 'node'));
+      }
+      elseif ($op1 == 'add') {
+        simplenews_subscribe_user($subs->mail, $tid, FALSE, 'website');
+        if ($path = variable_get('simplenews_confirm_subscribe_page', '')) {
+          $path = $path .'/'. implode('/', $arguments);
+          drupal_goto($path);
+        }
+        drupal_set_message(t('%user was added to the %newsletter mailing list.', array('%user' => $subs->mail, '%newsletter' => $newsletter->name)));
+        drupal_goto(variable_get('site_frontpage', 'node'));
+      }
     }
   }
 
@@ -132,12 +162,12 @@ function simplenews_confirm_add_form(&$f
   $form['question'] = array('#value' => '<p>'. t('Are you sure you want to add %user to the %newsletter mailing list?', array('%user' => $mail, '%newsletter' => $newsletter->name)) ."<p>\n");
   $form['mail'] = array('#type' => 'value', '#value' => $mail);
   $form['newsletter'] = array('#type' => 'value', '#value' => $newsletter);
-  $form['#redirect'] = '';
+  $form['#redirect'] = variable_get('simplenews_confirm_subscribe_page', '');
 
   return confirm_form($form,
     t('Confirm subscription'),
     '',
-    t('You always have the option of unsubscribing later.'),
+    t('You will receive %newsletter mails.', array('%newsletter' => $newsletter->name)),
     t('Subscribe'),
     t('Cancel')
   );
@@ -145,7 +175,11 @@ function simplenews_confirm_add_form(&$f
 
 function simplenews_confirm_add_form_submit($form, &$form_state) {
   simplenews_subscribe_user($form_state['values']['mail'], $form_state['values']['newsletter']->tid, FALSE, 'website');
-  drupal_set_message(t('%user was added to the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => $form_state['values']['newsletter']->name)));
+  
+  // Display message if user is directed to the front page.
+  if (!$form['#redirect']) {
+    drupal_set_message(t('%user was added to the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => $form_state['values']['newsletter']->name)));
+  }
 }
 
 /**
@@ -158,20 +192,24 @@ function simplenews_confirm_removal_form
   $form['question'] = array('#value' => '<p>'. t('Are you sure you want to remove %user from the %newsletter mailing list?', array('%user' => $mail, '%newsletter' => $newsletter->name)) ."<p>\n");
   $form['mail'] = array('#type' => 'value', '#value' => $mail);
   $form['newsletter'] = array('#type' => 'value', '#value' => $newsletter);
-  $form['#redirect'] = '';
+  $form['#redirect'] = variable_get('simplenews_confirm_unsubscribe_page', '');
 
   return confirm_form($form,
-    t('Confirm unsubscription'),
+    t('Confirm remove subscription'),
     '',
-    t('This action will unsubscribe you from the newsletter mailing list.'),
+    t('You will no longer receive %newsletter mails.', array('%newsletter' => $newsletter->name)),
     t('Unsubscribe'),
     t('Cancel')
   );
 }
 
 function simplenews_confirm_removal_form_submit($form, &$form_state) {
+drupal_set_message(print_r($form));
   simplenews_unsubscribe_user($form_state['values']['mail'], $form_state['values']['newsletter']->tid, FALSE, 'website');
-  drupal_set_message(t('%user was unsubscribed from the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => $form_state['values']['newsletter']->name)));
+  // Display message if user is directed to the front page.
+  if (!$form['#redirect']) {
+    drupal_set_message(t('%user was unsubscribed from the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => $form_state['values']['newsletter']->name)));
+  }
 }
 
 /**
