我试图覆盖用户配置文件编辑表单在Drupal 7,和我不断收到以下错误信息:未定义指数#帐户
注意:未定义指数:#帐户中template_preprocess_user_profile()(/var/www/menit/modules/user/user.pages.inc的第189行)。
注意:未定义的索引:rdf_preprocess_user_profile()中的#account(/var/www/menit/modules/rdf/rdf.module的第578行)。
注意:试图在user_uri()(/var/www/menit/modules/user/user.module的第190行)中获取非对象的属性。
注意:试图在rdf_preprocess_user_profile()(/var/www/menit/modules/rdf/rdf.module的第603行)中获取非对象的属性。
注意:试图在rdf_preprocess_user_profile()(/var/www/menit/modules/rdf/rdf.module的第604行)中获取非对象的属性。
我所做的是写一个自定义模块,包含下面的代码:
function custom_profile_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
global $user;
if ($user->uid != 1){
$form['#theme'] = 'user_profile';
}
}
function menit_theme($existing, $type, $theme, $path){
return array(
'user_profile' => array(
'render element' => 'form',
'template' => 'templates/user_profile',
),
);
}
,并增加了以下user_profile.tpl.theme我的主题模板文件夹:
<div class="profile"<?php print $attributes; ?>>
<?php print render($user_profile['field_second_name']); ?>
<?php print render($user_profile['field_first_name']);?>
<?php print render($user_profile);?>
</div>
我现在有点迷路,而且时间不够。有没有人知道我在这里做错了什么?
非常感谢Alberto,像现在的魅力一样 – Eytyy