Index: agreement.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/agreement/agreement.module,v
retrieving revision 1.10.2.2
diff -u -u -p -r1.10.2.2 agreement.module
--- agreement.module	9 Jun 2010 02:41:01 -0000	1.10.2.2
+++ agreement.module	29 Dec 2010 18:27:42 -0000
@@ -298,6 +298,12 @@ function agreement_settings() {
       '#default_value' => variable_get('agreement_page_visibility_pages', '<front>'),
       '#description' => $description,
   );
+ $form['agreement_email_recipient'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Email notification of agreement acceptance to'),
+    '#default_value' => variable_get('agreement_email_recipient', ''),
+    '#description' => t('If an email address is entered here, an email will be sent to that email address each time a user agrees. To have no email sent, leave this blank.'),
+  );
 
   return system_settings_form($form);
 }
@@ -413,6 +419,15 @@ function agreement_form_submit($form, &$
   drupal_set_message(check_plain(variable_get('agreement_message_success',
   AGREEMENT_MESSAGE_SUCCESS)));
 
+  // Send email notifying of acceptance if admin has set an email address 
+  // for this.
+  if (variable_get('agreement_email_recipient', '')) {
+    $params['account'] = user_load($uid);
+    $to = variable_get('agreement_email_recipient', '');
+    drupal_mail('agreement', 'notice', $to, 
+      user_preferred_language($params['account']), $params);
+  }
+
   $agreement_success_destination = check_plain(
   variable_get('agreement_success_destination', ''));
   $agreement_success_destination = str_replace('&lt;front&gt;', '<front>',
@@ -439,6 +454,19 @@ function agreement_form_submit($form, &$
   return;
 }
 
+/**
+ * Implements hook_mail().
+ */
+function agreement_mail($key, &$message, $params) {
+  switch($key) {
+    case 'notice':
+      $variables = user_mail_tokens($params['account'], $message['language']);
+      $message['subject'] = t('!sitename: !username signed agreement', 
+        $variables);
+      $message['body'][] = t('The user has accepted the agreement.');
+  }
+}
+
 /*********************************************************************
  INTERNAL
  *********************************************************************/
