more module updates
This commit is contained in:
@@ -49,6 +49,12 @@ function smtp_admin_settings() {
|
||||
'#options' => array(1 => t('On'), 0 => t('Off')),
|
||||
'#description' => t('To uninstall this module you must turn it off here first.'),
|
||||
);
|
||||
$form['onoff']['smtp_queue'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Send mail by queue'),
|
||||
'#default_value' => variable_get('smtp_queue', FALSE),
|
||||
'#description' => t('Mails will be sent by drupal queue api.'),
|
||||
);
|
||||
|
||||
$form['server'] = array(
|
||||
'#type' => 'fieldset',
|
||||
@@ -167,6 +173,8 @@ function smtp_admin_settings() {
|
||||
'#description' => t('Checking this box will print SMTP messages from the server for every e-mail that is sent.'),
|
||||
);
|
||||
|
||||
$form['#submit'][] = 'smtp_admin_settings_form_submit';
|
||||
|
||||
return system_settings_form($form);
|
||||
} // End of smtp_admin_settings().
|
||||
|
||||
@@ -205,3 +213,27 @@ function smtp_admin_settings_validate($form, &$form_state) {
|
||||
}
|
||||
} // End of smtp_admin_settings_validate().
|
||||
|
||||
/**
|
||||
* Submit handler().
|
||||
*/
|
||||
function smtp_admin_settings_form_submit($form, &$form_state) {
|
||||
// Check if SMTP status has been changed.
|
||||
if (
|
||||
(!variable_get('smtp_on', FALSE) && $form_state['values']['smtp_on']) ||
|
||||
(variable_get('smtp_on', FALSE) && !$form_state['values']['smtp_on'])
|
||||
) {
|
||||
$mail_modes = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
|
||||
|
||||
// Turning on.
|
||||
if ($form_state['values']['smtp_on']) {
|
||||
variable_set('smtp_previous_mail_system', $mail_modes['default-system']);
|
||||
$mail_modes['default-system'] = 'SmtpMailSystem';
|
||||
}
|
||||
// Turning off.
|
||||
else {
|
||||
$mail_modes['default-system'] = variable_get('smtp_previous_mail_system', 'DefaultMailSystem');
|
||||
}
|
||||
|
||||
variable_set('mail_system', $mail_modes);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user