- Patch #41352 by Steve, Zen, Crell et al: new feature: make the default behavior of the contact forms configurable.
parent
21649210f3
commit
4d97254559
|
@ -2,6 +2,7 @@ Drupal x.x.x, xxxx-xx-xx (development version)
|
||||||
------------------------
|
------------------------
|
||||||
- usability:
|
- usability:
|
||||||
* added support for auto-complete forms (AJAX) to user profiles.
|
* added support for auto-complete forms (AJAX) to user profiles.
|
||||||
|
* improved configurability of the contact forms.
|
||||||
|
|
||||||
Drupal 4.7.0, 2006-05-01
|
Drupal 4.7.0, 2006-05-01
|
||||||
------------------------
|
------------------------
|
||||||
|
|
|
@ -120,7 +120,7 @@ function contact_menu($may_cache) {
|
||||||
*
|
*
|
||||||
* Allows the user the option of enabling/disabling his personal contact form.
|
* 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') {
|
if ($type == 'form' && $category == 'account') {
|
||||||
$form['contact'] = array('#type' => 'fieldset',
|
$form['contact'] = array('#type' => 'fieldset',
|
||||||
'#title' => t('Contact settings'),
|
'#title' => t('Contact settings'),
|
||||||
|
@ -134,9 +134,12 @@ function contact_user($type, $edit, &$user, $category = NULL) {
|
||||||
);
|
);
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
if ($type == 'validate') {
|
elseif ($type == 'validate') {
|
||||||
return array('contact' => $edit['contact']);
|
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),
|
'#default_value' => variable_get('contact_hourly_threshold', 3),
|
||||||
'#description' => t('The maximum number of contact form submissions a user can perform per hour.'),
|
'#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',
|
$form['submit'] = array('#type' => 'submit',
|
||||||
'#value' => t('Save configuration'),
|
'#value' => t('Save configuration'),
|
||||||
);
|
);
|
||||||
|
|
|
@ -120,7 +120,7 @@ function contact_menu($may_cache) {
|
||||||
*
|
*
|
||||||
* Allows the user the option of enabling/disabling his personal contact form.
|
* 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') {
|
if ($type == 'form' && $category == 'account') {
|
||||||
$form['contact'] = array('#type' => 'fieldset',
|
$form['contact'] = array('#type' => 'fieldset',
|
||||||
'#title' => t('Contact settings'),
|
'#title' => t('Contact settings'),
|
||||||
|
@ -134,9 +134,12 @@ function contact_user($type, $edit, &$user, $category = NULL) {
|
||||||
);
|
);
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
if ($type == 'validate') {
|
elseif ($type == 'validate') {
|
||||||
return array('contact' => $edit['contact']);
|
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),
|
'#default_value' => variable_get('contact_hourly_threshold', 3),
|
||||||
'#description' => t('The maximum number of contact form submissions a user can perform per hour.'),
|
'#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',
|
$form['submit'] = array('#type' => 'submit',
|
||||||
'#value' => t('Save configuration'),
|
'#value' => t('Save configuration'),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue