diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-09 00:54:33 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-09 00:54:33 +0000 |
commit | 48dd14a898420ae98984c951f59e8d299080bee8 (patch) | |
tree | 4963afe765f7cb748fced7e6f4746655a34510e5 /modules/contact | |
parent | dcdb584f3315cb0b4c3b6dfe14135bc5a9d5b840 (diff) | |
download | brdo-48dd14a898420ae98984c951f59e8d299080bee8.tar.gz brdo-48dd14a898420ae98984c951f59e8d299080bee8.tar.bz2 |
- Patch #597784 by Dave Reid: rename 'administer site-wide contact form' to 'administer contact forms'.
Diffstat (limited to 'modules/contact')
-rw-r--r-- | modules/contact/contact.install | 10 | ||||
-rw-r--r-- | modules/contact/contact.module | 16 | ||||
-rw-r--r-- | modules/contact/contact.pages.inc | 6 | ||||
-rw-r--r-- | modules/contact/contact.test | 10 |
4 files changed, 26 insertions, 16 deletions
diff --git a/modules/contact/contact.install b/modules/contact/contact.install index 0ebe73c9e..744ad41d3 100644 --- a/modules/contact/contact.install +++ b/modules/contact/contact.install @@ -88,6 +88,16 @@ function contact_update_7000() { } /** + * Rename the administer contact forms permission. + */ +function contact_update_7001() { + db_update('role_permission') + ->fields(array('permission' => 'administer contact forms')) + ->condition('permission', 'administer site-wide contact form') + ->execute(); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 37a47dc79..925fb5904 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -37,13 +37,13 @@ function contact_help($path, $arg) { */ function contact_permission() { return array( - 'administer site-wide contact form' => array( - 'title' => t('Administer site-wide contact form'), - 'description' => t('Configure site-wide contact form administration settings.'), + 'administer contact forms' => array( + 'title' => t('Administer contact forms'), + 'description' => t('Manage contact forms and configure contact form adminstrative settings.'), ), 'access site-wide contact form' => array( 'title' => t('Access site-wide contact form'), - 'description' => t('Send feedback to administrators via e-mail using the site-wide contact form.'), + 'description' => t('Send e-mails to administer-defiend recipients using the site-wide contact form.'), ), ); } @@ -56,14 +56,14 @@ function contact_menu() { 'title' => 'Contact form', 'description' => 'Create a system contact form and set up categories for the form to use.', 'page callback' => 'contact_admin_categories', - 'access arguments' => array('administer site-wide contact form'), + 'access arguments' => array('administer contact forms'), 'file' => 'contact.admin.inc', ); $items['admin/structure/contact/add'] = array( 'title' => 'Add category', 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_admin_edit', 3), - 'access arguments' => array('administer site-wide contact form'), + 'access arguments' => array('administer contact forms'), 'type' => MENU_LOCAL_ACTION, 'weight' => 1, 'file' => 'contact.admin.inc', @@ -72,7 +72,7 @@ function contact_menu() { 'title' => 'Edit contact category', 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_admin_edit', 3, 4), - 'access arguments' => array('administer site-wide contact form'), + 'access arguments' => array('administer contact forms'), 'type' => MENU_CALLBACK, 'file' => 'contact.admin.inc', ); @@ -80,7 +80,7 @@ function contact_menu() { 'title' => 'Delete contact', 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_admin_delete', 4), - 'access arguments' => array('administer site-wide contact form'), + 'access arguments' => array('administer contact forms'), 'type' => MENU_CALLBACK, 'file' => 'contact.admin.inc', ); diff --git a/modules/contact/contact.pages.inc b/modules/contact/contact.pages.inc index de1a20caf..895fa4e3a 100644 --- a/modules/contact/contact.pages.inc +++ b/modules/contact/contact.pages.inc @@ -11,11 +11,11 @@ * Site-wide contact page. */ function contact_site_page() { - if (!flood_is_allowed('contact', variable_get('contact_threshold_limit', 5), variable_get('contact_threshold_window', 3600)) && !user_access('administer site-wide contact form')) { + if (!flood_is_allowed('contact', variable_get('contact_threshold_limit', 5), variable_get('contact_threshold_window', 3600)) && !user_access('administer contact forms')) { $output = t("You cannot send more than %number messages in @interval. Please try again later.", array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(variable_get('contact_threshold_window', 3600)))); } elseif (!db_query("SELECT COUNT(cid) FROM {contact}")->fetchField()) { - if (user_access('administer site-wide contact form')) { + if (user_access('administer contact forms')) { $output = t('The contact form has not been configured. <a href="@add">Add one or more categories</a> to the form.', array('@add' => url('admin/structure/contact/add'))); } else { @@ -157,7 +157,7 @@ function contact_personal_page($account) { if (!valid_email_address($user->mail)) { $output = t('You need to provide a valid e-mail address to contact other users. Please update your <a href="@url">user information</a> and try again.', array('@url' => url("user/$user->uid/edit", array('query' => drupal_get_destination())))); } - elseif (!flood_is_allowed('contact', variable_get('contact_threshold_limit', 5), variable_get('contact_threshold_window', 3600)) && !user_access('administer site-wide contact form')) { + elseif (!flood_is_allowed('contact', variable_get('contact_threshold_limit', 5), variable_get('contact_threshold_window', 3600)) && !user_access('administer contact forms')) { $output = t("You cannot send more than %number messages in @interval. Please try again later.", array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(variable_get('contact_threshold_window', 3600)))); } else { diff --git a/modules/contact/contact.test b/modules/contact/contact.test index 300142836..09eb1e522 100644 --- a/modules/contact/contact.test +++ b/modules/contact/contact.test @@ -22,9 +22,9 @@ class ContactSitewideTestCase extends DrupalWebTestCase { */ function testSiteWideContact() { // Create and login administrative user. - $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer site-wide contact form', 'administer users')); + $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer users')); $this->drupalLogin($admin_user); - + $flood_limit = 3; variable_set('contact_threshold_limit', $flood_limit); variable_set('contact_threshold_window', 600); @@ -156,7 +156,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase { */ function testAutoReply() { // Create and login administrative user. - $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer site-wide contact form', 'administer permissions', 'administer users')); + $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users')); $this->drupalLogin($admin_user); // Set up three categories, 2 with an auto-reply and one without. @@ -290,9 +290,9 @@ class ContactPersonalTestCase extends DrupalWebTestCase { * Test personal contact form. */ function testPersonalContact() { - $admin_user = $this->drupalCreateUser(array('administer site-wide contact form', 'administer users')); + $admin_user = $this->drupalCreateUser(array('administer contact forms', 'administer users')); $this->drupalLogin($admin_user); - + $flood_limit = 3; variable_set('contact_threshold_limit', $flood_limit); |