我正在尝试使用下面的代码在Drupal 6中显示我的用户配置文件的“注册信息”组。执行此代码时,将显示配置文件表单中的字段标签,但输入字段不是。页面源没有表单标记。此代码适用于D6的其他安装 - 所以我相信它有效。任何想法从哪里开始调试?
global $user;
$uid = $user->uid;
if ($uid > 0) {
include_once drupal_get_path('module', 'user') . '/user.pages.inc';
$profile = profile_load_profile($user);
print(drupal_get_form('user_profile_form', $user, 'Registration Information'));
}
答案 0 :(得分:0)
看起来你正在使用profile_load_profile()函数,但是你在下一行中没有使用该配置文件。而是使用全球$用户。我在这里猜测,但你不是在加载配置文件,因为你需要在下一行吗?
所以而不是:
print(drupal_get_form('user_profile_form', $user, 'Registration Information'));
尝试:
print(drupal_get_form('user_profile_form', $profile, 'Registration Information'));
答案 1 :(得分:0)
谢谢大家。结束工作的唯一事情是:
global $user;
module_load_include('inc', 'user', 'user.pages');
print user_edit($user, 'Registration Information');