diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-05-13 10:19:13 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-05-13 10:19:13 +0000 |
commit | 4d9725455963e4d3b39f264217b3b0950d138d04 (patch) | |
tree | 7b53af3fedb3d588c1be7ea741d07b7f14df804c /modules | |
parent | 21649210f354495f7d7f6dfed31bdefa3cbf4509 (diff) | |
download | brdo-4d9725455963e4d3b39f264217b3b0950d138d04.tar.gz brdo-4d9725455963e4d3b39f264217b3b0950d138d04.tar.bz2 |
- Patch #41352 by Steve, Zen, Crell et al: new feature: make the default behavior of the contact forms configurable.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/contact.module | 13 | ||||
-rw-r--r-- | modules/contact/contact.module | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/modules/contact.module b/modules/contact.module index 07bcd9553..051235b14 100644 --- a/modules/contact.module +++ b/modules/contact.module @@ -120,7 +120,7 @@ function contact_menu($may_cache) { * * Allows the user the option of enabling/disabling his personal contact form. */ -function contact_user($type, $edit, &$user, $category = NULL) { +function contact_user($type, &$edit, &$user, $category = NULL) { if ($type == 'form' && $category == 'account') { $form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact settings'), @@ -134,9 +134,12 @@ function contact_user($type, $edit, &$user, $category = NULL) { ); return $form; } - if ($type == 'validate') { + elseif ($type == 'validate') { return array('contact' => $edit['contact']); } + elseif ($type == 'insert') { + $edit['contact'] = variable_get('contact_default_status', 1); + } } /** @@ -291,6 +294,12 @@ function contact_admin_settings() { '#default_value' => variable_get('contact_hourly_threshold', 3), '#description' => t('The maximum number of contact form submissions a user can perform per hour.'), ); + $form['contact_default_status'] = array( + '#type' => 'checkbox', + '#title' => t('Enable personal contact form by default'), + '#default_value' => variable_get('contact_default_status', 1), + '#description' => t('Default status of the personal contact form for new users.'), + ); $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'), ); diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 07bcd9553..051235b14 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -120,7 +120,7 @@ function contact_menu($may_cache) { * * Allows the user the option of enabling/disabling his personal contact form. */ -function contact_user($type, $edit, &$user, $category = NULL) { +function contact_user($type, &$edit, &$user, $category = NULL) { if ($type == 'form' && $category == 'account') { $form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact settings'), @@ -134,9 +134,12 @@ function contact_user($type, $edit, &$user, $category = NULL) { ); return $form; } - if ($type == 'validate') { + elseif ($type == 'validate') { return array('contact' => $edit['contact']); } + elseif ($type == 'insert') { + $edit['contact'] = variable_get('contact_default_status', 1); + } } /** @@ -291,6 +294,12 @@ function contact_admin_settings() { '#default_value' => variable_get('contact_hourly_threshold', 3), '#description' => t('The maximum number of contact form submissions a user can perform per hour.'), ); + $form['contact_default_status'] = array( + '#type' => 'checkbox', + '#title' => t('Enable personal contact form by default'), + '#default_value' => variable_get('contact_default_status', 1), + '#description' => t('Default status of the personal contact form for new users.'), + ); $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'), ); |