--- subscriptions.module.dist   2009-02-02 21:25:26.000000000 -0700
+++ subscriptions.module        2009-02-03 09:23:27.000000000 -0700
@@ -196,10 +196,23 @@
 function subscriptions_user($type, $edit, &$account, $category = NULL) {
   static $new_uid = 0;
   switch ($type) {
+    /** 
+    * Added 02/02/2009 by JSR to allow subscription upon registration.
+    **/
+    case 'register':
+        return _subscriptions_user_reg_fields();
+        break;
+    /* End addition */
+
     case 'insert':
       db_query("INSERT INTO {subscriptions_user} (uid) VALUES(%d)", $account->uid);
       // $account->roles isn't set yet, but we'll be called again with 'load'
       $new_uid = $account->uid;
+      /* Added by JSR to permit opt-in during registration 02/02/2009 */  
+      if (isset($edit['subscriptions_decision']) && $edit['subscriptions_decision'] == 1){
+            db_query('INSERT INTO {subscriptions} (module, field, value, recipient_uid, send_interval, author_uid, send_updates, send_comments) VALUES (\'%s\', \'%s\', \'%s\', %d, %d, %d, %d, %d)', 'node', 'type', 'story', $account->uid, 1, -1, 1, 1);
+       $edit['subscriptions_decision'] = NULL;
+       }
       break;
 
     case 'load':
@@ -210,7 +223,10 @@
         db_query("INSERT INTO {subscriptions} (module, field, value, recipient_uid, send_interval, author_uid, send_updates, send_comments)
                   SELECT module, field, value, %d, send_interval, author_uid, send_updates, send_comments FROM {subscriptions}
                   WHERE recipient_uid IN (%s)", $account->uid, implode(',', $rids));
+      /* End addition */
         $new_uid = 0;
+      break;
+
       }
       break;
 
@@ -545,3 +561,28 @@
   }
   return $defaults[$uid][$name];
 }
+
+
+/**
+* Added by JSR 02/02/2009 for subscriptions on registration
+**/
+function _subscriptions_user_reg_fields() {
+  // Add a fieldset containing a checkbox for users to accept
+  // getting updates on the registration form.
+  $fields['subscriptions_agree'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('News Subscriptions')
+  );
+
+  // Add the checkbox to the fieldset
+  $fields['subscriptions_agree']['subscriptions_decision'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Subscribe to news posted on this site. Emails are sent every whenever a new article is posted.'),
+    '#return_value' => 1,
+    '#default_value' => 1,
+    '#description' => t('By subscribing to <em>email updates</em>, you will be kept informed of news associated with ' . variable_get('site_name', 'Drupal') . '.')
+  );
+
+  return $fields;
+}
+/* End addition */
