Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.782 diff -u -p -r1.782 user.module --- modules/user/user.module 17 May 2007 21:33:59 -0000 1.782 +++ modules/user/user.module 17 May 2007 23:19:34 -0000 @@ -1699,11 +1699,23 @@ function _user_mail_text($messageid, $va case 'approval_subject': return t('Account details for !username at !site (pending admin approval)', $variables); case 'approval_body': - return t("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been granted, you may log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you may wish to change your password at !edit_uri\n\n\n-- !site team", $variables); + return t("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- !site team", $variables); case 'pass_subject': return t('Replacement login information for !username at !site', $variables); case 'pass_body': return t("!username,\n\nA request to reset the password for your account has been made at !site.\n\nYou may now log in to !uri_brief clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.", $variables); + case 'active_subject': + return t('Account details for !username at !site (approved)', $variables); + case 'active_body': + return "!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using the following username:\n\nusername: !username\n"; + case 'blocked_subject': + return t('Account details for !username at !site (blocked)', $variables); + case 'blocked_body': + return "!username,\n\nYour account on !site has been blocked."; + case 'deleted_subject': + return t('Account details for !username at !site (deleted)', $variables); + case 'deleted_body': + return "!username,\n\nYour account on !site has been deleted."; } } } @@ -2455,65 +2467,165 @@ function user_admin_settings() { $form['email'] = array( '#type' => 'fieldset', '#title' => t('User e-mail settings'), + '#description' => t('Drupal will send emails whenever new users register on your site. The following settings allow you to customize the subject and body of each message. You can also configure the message sent when users request a new password. Additionally, you can configure your site to automatically notify users when their accounts are deleted, blocked, or activated. Notification when accounts are activated is particularly useful when your site requires administrator approval for new account requests.'), ); // These email tokens are shared for all settings, so just define // the list once to help ensure they stay in sync. $email_token_help = t('Available variables are:') .' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.'; - $form['email']['user_mail_welcome_subject'] = array( + + $form['email']['welcome_admin'] = array( + '#type' => 'fieldset', + '#title' => t('Welcome message (user created by administrator)'), + '#collapsible' => TRUE, + '#collapsed' => (variable_get('user_register', 1) != 0), + '#description' => t('Customize the welcome e-mail message that is sent to new member accounts created by an administrator.') .' '. $email_token_help, + ); + $form['email']['welcome_admin']['user_mail_admin_subject'] = array( '#type' => 'textfield', - '#title' => t('Subject of welcome e-mail'), - '#default_value' => _user_mail_text('welcome_subject'), + '#title' => t('Subject'), + '#default_value' => _user_mail_text('admin_subject'), '#maxlength' => 180, - '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. $email_token_help ); - $form['email']['user_mail_welcome_body'] = array( + $form['email']['welcome_admin']['user_mail_admin_body'] = array( '#type' => 'textarea', - '#title' => t('Body of welcome e-mail'), - '#default_value' => _user_mail_text('welcome_body'), + '#title' => t('Body'), + '#default_value' => _user_mail_text('admin_body'), '#rows' => 15, - '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. $email_token_help, ); - $form['email']['user_mail_admin_subject'] = array( + + $form['email']['welcome_open'] = array( + '#type' => 'fieldset', + '#title' => t('Welcome message (no approval required)'), + '#collapsible' => TRUE, + '#collapsed' => (variable_get('user_register', 1) != 1), + '#description' => t('Customize the welcome e-mail message that is sent to new members upon registering when no administrator approval is required.') .' '. $email_token_help + ); + $form['email']['welcome_open']['user_mail_welcome_subject'] = array( '#type' => 'textfield', - '#title' => t('Subject of welcome e-mail (user created by administrator)'), - '#default_value' => _user_mail_text('admin_subject'), + '#title' => t('Subject'), + '#default_value' => _user_mail_text('welcome_subject'), '#maxlength' => 180, - '#description' => t('Customize the subject of your welcome e-mail, which is sent to new member accounts created by an administrator.') .' '. $email_token_help, ); - $form['email']['user_mail_admin_body'] = array( + $form['email']['welcome_open']['user_mail_welcome_body'] = array( '#type' => 'textarea', - '#title' => t('Body of welcome e-mail (user created by administrator)'), - '#default_value' => _user_mail_text('admin_body'), + '#title' => t('Body'), + '#default_value' => _user_mail_text('welcome_body'), '#rows' => 15, - '#description' => t('Customize the body of the welcome e-mail, which is sent to new member accounts created by an administrator.') .' '. $email_token_help, ); - $form['email']['user_mail_approval_subject'] = array( + + $form['email']['welcome_approval'] = array( + '#type' => 'fieldset', + '#title' => t('Welcome message (awaiting administrator approval)'), + '#collapsible' => TRUE, + '#collapsed' => (variable_get('user_register', 1) != 2), + '#description' => t('Customize the welcome message which is sent to new members that are awaiting approval.') .' '. $email_token_help, + ); + $form['email']['welcome_approval']['user_mail_approval_subject'] = array( '#type' => 'textfield', - '#title' => t('Subject of welcome e-mail (awaiting admin approval)'), + '#title' => t('Subject'), '#default_value' => _user_mail_text('approval_subject'), '#maxlength' => 180, - '#description' => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. $email_token_help, ); - $form['email']['user_mail_approval_body'] = array( + $form['email']['welcome_approval']['user_mail_approval_body'] = array( '#type' => 'textarea', - '#title' => t('Body of welcome e-mail (awaiting admin approval)'), + '#title' => t('Body'), '#default_value' => _user_mail_text('approval_body'), '#rows' => 15, - '#description' => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. $email_token_help, ); - $form['email']['user_mail_pass_subject'] = array( + + $form['email']['pass_recover'] = array( + '#type' => 'fieldset', + '#title' => t('Password recovery message'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('Customize the e-mail message sent to users that request a new password.') .' '. $email_token_help, + ); + $form['email']['pass_recover']['user_mail_pass_subject'] = array( '#type' => 'textfield', - '#title' => t('Subject of password recovery e-mail'), + '#title' => t('Subject'), '#default_value' => _user_mail_text('pass_subject'), '#maxlength' => 180, - '#description' => t('Customize the subject of your forgotten password e-mail.') .' '. $email_token_help, ); - $form['email']['user_mail_pass_body'] = array( + $form['email']['pass_recover']['user_mail_pass_body'] = array( '#type' => 'textarea', - '#title' => t('Body of password recovery e-mail'), + '#title' => t('Body'), '#default_value' => _user_mail_text('pass_body'), '#rows' => 15, - '#description' => t('Customize the body of the forgotten password e-mail.') .' '. $email_token_help, + ); + + $form['email']['activated'] = array( + '#type' => 'fieldset', + '#title' => t('Account activation notification message'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('Configure if an e-mail message should be sent to users when their accounts are activated, and if so, what the subject and body should be. This is particularly useful if your site requires administrator approval for new account requests.') .' '. $email_token_help, + ); + $form['email']['activated']['user_mail_active_notify'] = array( + '#type' => 'checkbox', + '#title' => t('Notify user when account is activated.'), + '#default_value' => variable_get('user_mail_active_notify', TRUE), + ); + $form['email']['activated']['user_mail_active_subject'] = array( + '#type' => 'textfield', + '#title' => t('Subject'), + '#default_value' => _user_mail_text('active_subject'), + '#maxlength' => 180, + ); + $form['email']['activated']['user_mail_active_body'] = array( + '#type' => 'textarea', + '#title' => t('Body'), + '#default_value' => _user_mail_text('active_body'), + '#rows' => 15, + ); + + $form['email']['blocked'] = array( + '#type' => 'fieldset', + '#title' => t('Account blocked notification message'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('Configure if an e-mail message should be sent to users when their accounts are blocked, and if so, what the subject and body should be.') .' '. $email_token_help, + ); + $form['email']['blocked']['user_mail_blocked_notify'] = array( + '#type' => 'checkbox', + '#title' => t('Notify user when account is blocked.'), + '#default_value' => variable_get('user_mail_blocked_notify', FALSE), + ); + $form['email']['blocked']['user_mail_blocked_subject'] = array( + '#type' => 'textfield', + '#title' => t('Subject'), + '#default_value' => _user_mail_text('blocked_subject'), + '#maxlength' => 180, + ); + $form['email']['blocked']['user_mail_blocked_body'] = array( + '#type' => 'textarea', + '#title' => t('Body'), + '#default_value' => _user_mail_text('blocked_body'), + '#rows' => 15, + ); + + $form['email']['deleted'] = array( + '#type' => 'fieldset', + '#title' => t('Account deleted notification message'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('Configure if an e-mail message should be sent to users when their accounts are deleted, and if so, what the subject and body should be.') .' '. $email_token_help, + ); + $form['email']['deleted']['user_mail_deleted_notify'] = array( + '#type' => 'checkbox', + '#title' => t('Notify user when account is deleted.'), + '#default_value' => variable_get('user_mail_deleted_notify', FALSE), + ); + $form['email']['deleted']['user_mail_deleted_subject'] = array( + '#type' => 'textfield', + '#title' => t('Subject'), + '#default_value' => _user_mail_text('deleted_subject'), + '#maxlength' => 180, + ); + $form['email']['deleted']['user_mail_deleted_body'] = array( + '#type' => 'textarea', + '#title' => t('Body'), + '#default_value' => _user_mail_text('deleted_body'), + '#rows' => 15, ); // User signatures.