diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc index 2409486..7dea65c 100644 --- a/modules/user/user.admin.inc +++ b/modules/user/user.admin.inc @@ -436,12 +436,13 @@ function user_admin_settings() { '#default_value' => variable_get('user_picture_guidelines', ''), '#description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users."), ); + // Default notifications address. - $form['mail_notification_address'] = array( + $form['user_mail_notification_address'] = array( '#type' => 'textfield', '#title' => t('Notification e-mail address'), - '#default_value' => variable_get('mail_notification_address'), - '#description' => t("The e-mail address to be used as the 'from' address for all notifications. If 'Visitors, but administrator approval is required' is selected above, a notification email will also be sent to this address for any new registrations. Leave empty to use the default system e-mail address (%site-email).", array('%site-email' => variable_get('site_mail'))), + '#default_value' => variable_get('user_mail_notification_address'), + '#description' => t("The e-mail address to be used as the \"from\" address for all notifications. If Visitors, but administrator approval is required is selected above, a notification e-mail will also be sent to this address for any new registrations. Leave empty to use the default system e-mail address (%site-email).", array('%site-email' => variable_get('site_mail', ini_get('sendmail_from')))), '#size' => 30, '#maxlength' => 255, ); diff --git a/modules/user/user.module b/modules/user/user.module index fbe3240..e963a87 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -3628,14 +3628,11 @@ function _user_mail_notify($op, $account, $language = NULL) { $notify = variable_get('user_mail_' . $op . '_notify', $default_notify); // Get the custom site notification email to use as the from email address // if it has been set. - $site_mail = variable_get('mail_notification_address'); + $site_mail = variable_get('user_mail_notification_address'); // If the custom site notification email has not been set, we use the site // default for this. - if (empty($site_mail)) { - $site_mail = variable_get('site_mail'); - } - if (empty($site_mail)) { - $site_mail = ini_get('sendmail_from'); + if (!($site_mail)) { + $site_mail = variable_get('site_mail', ini_get('sendmail_from')); } if ($notify) { $params['account'] = $account; diff --git a/modules/user/user.test b/modules/user/user.test index adfa21b..e6154b0 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -50,15 +50,14 @@ class UserRegistrationTestCase extends DrupalWebTestCase { } /** - * Test user registration approval email is sent to an custom email - * address, if it is set. + * Tests the user registration notification e-mail address. */ function testNotificationEmailAddress() { // Test that the Notification E-mail address field is on the config page. $admin_user = $this->drupalCreateUser(array('administer users')); $this->drupalLogin($admin_user); $this->drupalGet('admin/config/people/accounts'); - $this->assertRaw('id="edit-mail-notification-address"', 'Notification E-mail address field exists'); + $this->assertRaw('id="edit-user-mail-notification-address"', 'Notification e-mail address field exists.'); $this->drupalLogout(); // Test custom user registration approval email address(es). @@ -69,7 +68,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $server_address = $this->randomName() . '@example.com'; $notify_address = $this->randomName() . '@example.com'; variable_set('site_mail', $server_address); - variable_set('mail_notification_address', $notify_address); + variable_set('user_mail_notification_address', $notify_address); // Register a new user account. $edit = array(); $edit['name'] = $name = $this->randomName(); @@ -84,7 +83,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { 'from' => $server_address, 'subject' => $subject, )); - $this->assertTrue(count($admin_mail), 'New user mail to admin is sent to configured Notification E-mail address'); + $this->assertTrue(count($admin_mail), 'New user mail to admin is sent to configured notification e-mail address.'); // Ensure that user notification mail is sent from the configured // Notification E-mail address. $user_mail = $this->drupalGetMails(array( @@ -93,7 +92,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { 'from' => $notify_address, 'subject' => $subject, )); - $this->assertTrue(count($user_mail), 'New user mail to user is sent from configured Notification E-mail address'); + $this->assertTrue(count($user_mail), 'New user mail to user is sent from configured notification e-mail address.'); } function testRegistrationWithoutEmailVerification() {