0

我有一种情况,在完成基本注册后,用户被重定向到他需要填写一个小表格的页面。

我的目标是实施hook_user_inserthook_menu做这样的事情

function registration_user_insert(&$edit, $account, $category){
drupal_goto('splan/'.$edit['uid']);
}

function registration_menu() {
$items['splan/%'] = array(
'title' => 'Select a Plan',
'page callback' => 'drupal_get_form',
'page arguments' => array('selectplan_form'),
'access callback' => TRUE,
'type' => MENU_CALLBACK
);
return $items;
}

在 selectplan_form 中,我将定义我的新表单,然后使用 uid 将数据保存到用户表中。

现在发生的事情是在提交基本用户注册表单之后重定向到 splan/uid 正在发生,但我也收到以下错误。

You are not authorized to access this page.

现在我已更改权限以允许匿名。用户创建和编辑网络表单,但问题仍然存在。

请帮忙!!!!!!!!

4

2 回答 2

1

您所指的表格是否必须在用户注册后填写?如果是这样,这是一个有点棘手的情况。无论哪种方式,将 drupal_goto 放入 user_insert 钩子都会中断注册过程。如果您的表单不要求用户首先注册,您只需更改注册表以包含表单上的任何额外字段。为此,您需要实现一个 hook_from_alter():

http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_form_alter/7

于 2011-04-13T00:59:16.127 回答
1

尝试删除'access callback' => TRUE,并添加'access arguments' => array('access content'),

也许您忘记清除缓存?

于 2011-04-12T06:58:42.547 回答