Commit 8f7fb49a authored by Matthias Hutterer's avatar Matthias Hutterer
Browse files

Fixed contact form page callback.

parent 9e15a5dc
...@@ -256,12 +256,12 @@ function theme_email_textfield($element) { ...@@ -256,12 +256,12 @@ function theme_email_textfield($element) {
* Implementation of hook_menu(). * Implementation of hook_menu().
*/ */
function email_menu() { function email_menu() {
$items['email/%/%'] = array( $items['email/%node/%'] = array(
'title' => 'Email Contact Form', 'title' => 'Email Contact Form',
'page callback' => 'email_mail_page', 'page callback' => 'email_mail_page',
'page arguments' => array(1, 2), 'page arguments' => array(1, 2),
'access callback' => 'user_access', 'access callback' => 'node_access',
'access arguments' => array('access content'), 'access arguments' => array('view', 1),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
); );
$items['admin/settings/email'] = array( $items['admin/settings/email'] = array(
...@@ -277,19 +277,22 @@ function email_menu() { ...@@ -277,19 +277,22 @@ function email_menu() {
/** /**
* The contact form page. * The contact form page.
*
* @param $node
* The node object on which the email address is stored.
* @param $field_name
* The name of the CCK field which holds the email address.
*
* @return
* Rendered page output containing either the contact form or a flood warning.
*/ */
function email_mail_page($nid, $field_name) { function email_mail_page($node, $field_name) {
if (!is_numeric($nid)) {
drupal_not_found();
return;
}
if (module_exists('content_permissions')) { if (module_exists('content_permissions')) {
if (!user_access('view '. $field_name)) { if (!user_access('view '. $field_name)) {
drupal_not_found(); drupal_not_found();
return; return;
} }
} }
$node = node_load(intval($nid));
if (!$node) { if (!$node) {
drupal_not_found(); drupal_not_found();
return; return;
......
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