Commit 64eead44 authored by Dries's avatar Dries

- Patch #61600 by Ber: new feature: added additional permissions for contact forms.

parent bddd9aeb
......@@ -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,
);
}
......
......@@ -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,
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment