Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7 Drupal 7,在页面中插入用户配置文件表单_Drupal 7 - Fatal编程技术网

Drupal 7 Drupal 7,在页面中插入用户配置文件表单

Drupal 7 Drupal 7,在页面中插入用户配置文件表单,drupal-7,Drupal 7,我试图在页面中插入用户配置文件表单。代码相当简单: 全球$用户; 模块加载包括('inc','user','user.pages'); 打印drupal_render(drupal_get_form('user_profile_form',$user,'account') 除了上传图像外,一切正常,它显示: “警告:call\u user\u func\u array()[function.call user func array]:第一个参数应该是有效的回调,“user\u profile\u

我试图在页面中插入用户配置文件表单。代码相当简单:

全球$用户; 模块加载包括('inc','user','user.pages'); 打印drupal_render(drupal_get_form('user_profile_form',$user,'account')

除了上传图像外,一切正常,它显示:

“警告:call\u user\u func\u array()[function.call user func array]:第一个参数应该是有效的回调,“user\u profile\u form”在drupal\u retrieve\u form()中给出。”

任何想法,您都需要使用而不是模块来加载/构建表单,并且必须在$form\u state内传递参数

您要查找的代码如下所示:

    $form_id = 'user_profile_form';
    $form_state = array();
    //passing arguments to form.
    $form_state['build_info']['args'] = array($account, 'account');

    form_load_include($form_state, 'inc', 'user', 'user.pages');

    $form = drupal_build_form($form_id, $form_state);
您需要使用而不是模块\u load\u include来加载/构建表单,并且必须在$form\u state内传递参数

您要查找的代码如下所示:

    $form_id = 'user_profile_form';
    $form_state = array();
    //passing arguments to form.
    $form_state['build_info']['args'] = array($account, 'account');

    form_load_include($form_state, 'inc', 'user', 'user.pages');

    $form = drupal_build_form($form_id, $form_state);

为防止通知或警告:

正在尝试获取user\u account\u form()中非对象的属性(第1019行/var/www/modules/user/user.module)

将最后两行更改为:

<?php 
    $output_form = drupal_get_form($form_id); 
    print render($output_form); 
?>

为防止出现通知或警告:

正在尝试获取user\u account\u form()中非对象的属性(第1019行/var/www/modules/user/user.module)

将最后两行更改为:

<?php 
    $output_form = drupal_get_form($form_id); 
    print render($output_form); 
?>


要构建$account变量,请使用以下代码global$user$帐户=用户\构建\内容($user);这确实有效,但我得到了:注意:尝试获取user_account_form()中非对象的属性(第1019行/var/www/modules/user/user.module)要构建$account变量,请使用以下代码global$user$帐户=用户\构建\内容($user);这确实有效,但我得到:注意:尝试获取user\u account\u form()中非对象的属性(第1019行/var/www/modules/user/user.module)