我剛剛開始在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