diff --git a/modules/contact.module b/modules/contact.module index 48f97137a1cda301fc52d37c4ee9c8c07c36bf4a..07bcd9553f02c102d63af45664d4af739950f2d8 100644 --- a/modules/contact.module +++ b/modules/contact.module @@ -37,6 +37,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(). */ @@ -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 48f97137a1cda301fc52d37c4ee9c8c07c36bf4a..07bcd9553f02c102d63af45664d4af739950f2d8 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -37,6 +37,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(). */ @@ -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, ); }