diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-05-12 18:12:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-05-12 18:12:21 +0000 |
commit | 64eead44071c81d335aa686cb6c5d60cdbcf3502 (patch) | |
tree | 7df303ab8fedfc4254b7da056b5150e44b76bb5f | |
parent | bddd9aeb6fdc95f8e40c002ca18dfb10eebb38d9 (diff) | |
download | brdo-64eead44071c81d335aa686cb6c5d60cdbcf3502.tar.gz brdo-64eead44071c81d335aa686cb6c5d60cdbcf3502.tar.bz2 |
- Patch #61600 by Ber: new feature: added additional permissions for contact forms.
-rw-r--r-- | modules/contact.module | 12 | ||||
-rw-r--r-- | modules/contact/contact.module | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/modules/contact.module b/modules/contact.module index 48f97137a..07bcd9553 100644 --- a/modules/contact.module +++ b/modules/contact.module @@ -38,6 +38,12 @@ function contact_help($section) { } /** + * Implementation of hook_perm + */ +function contact_perm() { + return array('access site-wide contact form', 'access personal contact forms'); +} +/** * Implementation of hook_menu(). */ function contact_menu($may_cache) { @@ -89,16 +95,18 @@ function contact_menu($may_cache) { $items[] = array('path' => 'contact', 'title' => t('contact'), 'callback' => 'contact_mail_page', - 'access' => user_access('access content'), + 'access' => user_access('access site-wide contact form'), 'type' => MENU_SUGGESTED_ITEM, ); } else { if (arg(0) == 'user' && is_numeric(arg(1))) { - $items[] = array('path' => "user/". arg(1) ."/contact", + global $user; + $items[] = array('path' => 'user/'. arg(1) .'/contact', 'title' => t('contact'), 'callback' => 'contact_mail_user', 'type' => MENU_LOCAL_TASK, + 'access' => ($user->uid && user_access('access personal contact forms')), 'weight' => 2, ); } diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 48f97137a..07bcd9553 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -38,6 +38,12 @@ function contact_help($section) { } /** + * Implementation of hook_perm + */ +function contact_perm() { + return array('access site-wide contact form', 'access personal contact forms'); +} +/** * Implementation of hook_menu(). */ function contact_menu($may_cache) { @@ -89,16 +95,18 @@ function contact_menu($may_cache) { $items[] = array('path' => 'contact', 'title' => t('contact'), 'callback' => 'contact_mail_page', - 'access' => user_access('access content'), + 'access' => user_access('access site-wide contact form'), 'type' => MENU_SUGGESTED_ITEM, ); } else { if (arg(0) == 'user' && is_numeric(arg(1))) { - $items[] = array('path' => "user/". arg(1) ."/contact", + global $user; + $items[] = array('path' => 'user/'. arg(1) .'/contact', 'title' => t('contact'), 'callback' => 'contact_mail_user', 'type' => MENU_LOCAL_TASK, + 'access' => ($user->uid && user_access('access personal contact forms')), 'weight' => 2, ); } |