我刚刚开始在drupal上,所以如果这是一个非常愚蠢的问题,请致歉。我编写了以下模块,但每次尝试访问它时,都会转到url(http:// localhost:8888/drupal/doodil_viral_signup),我得到一条拒绝访问的消息。我已经尝试重建权限并禁用并重新启用模块,但它似乎不起作用。Drupal“您无权访问此页面。”
<?php
// $Id$
/**
* @file
* A module to encourage users to sign up.
* This module allows users to sign up to register for the site, and invite their friends to do the same.
*/
/**
* Implements hook_help().
*/
function doodil_viral_signup_help($path, $arg) {
if ($path == 'admin/help#first') {
return t('This module allows users to sign up to register for the site, and invite their friends to do the same.');
}
}
/**
* Implements hook_menu().
*/
function doodil_viral_signup_menu($may_cache = true) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'doodil_viral_signup',
'title' => t('Doodil Signup'),
'callback' => 'doodil_viral_signup_page',
'access' => TRUE,
'type' => MENU_CALLBACK,
);
}
return $items;
}
function doodil_viral_signup_page() {
return drupal_get_form('doodil_viral_signup_page_form');
}
function doodil_viral_signup_page_form() {
// [input text] First Name
$form['first_name'] = array(
'#type' => 'textfield',
'#title' => t('First Name'),
);
// [input text] Last Name
$form['last_name'] = array(
'#type' => 'textfield',
'#title' => t('Last Name'),
);
// [input text] Email Address
$form['email_address'] = array(
'#type' => 'textfield',
'#title' => t('Email Address'),
);
// [input submit] Sign Me Up
$form['submit'] = array(
'#type' => 'submit',
'#title' => t('Sign Me Up'),
);
return $form;
}
function doodil_viral_signup_page_form_submit($form_id, $form_values) {
$message = 'You have submitted the following information <pre>'.print_r($form_values).'</pre>';
drupal_set_message(t($message));
}
谁能告诉我如何解决这个问题?
在此先感谢!
仍然没有:(我已经通过了整个模块代码,并确保我没有做过任何愚蠢的事情,比如缺少分号(以及其他所有与打字速度相关的各种废话) 是否愿意仔细看看代码和我的Drupal安装?我很高兴给管理员访问等。 – 2012-02-28 19:21:08
检查我编辑的答案。 – 2012-02-28 20:08:05