Hello,

I want to render the submissions of the current user on his page.
For this, I uses this code

<?php
	$nid = 41;
        $sid = 42;
	$node = node_load($nid);
        include_once drupal_get_path('module','webform') . '/includes/webform.submissions.inc';
        $submission = webform_get_submission($nid, $sid);
        $email = NULL;
        $format = "html";
        print webform_submission_render($node, $submission, $email, $format);			
?>

But I get an empty array.
However with a print_r($submission) I get an array with the datas of the current user submission. The "webform_submission_render" function don't work...

Have you any idea to resolve my problem ?
Thanks for your help.

Comments

kumkum29 created an issue. See original summary.

kumkum29’s picture

Hello,

after several tests, the function ("webform_submission_render") seems to be correct. But on the user page I get an error : "EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids()".

If I place this code in a node or page template, the results of the submission in html are rendered.
If I place this code in the page--user.tpl.php or in user-profile template, the page is broken and I get the above error.

After using devel & the backtrace function, it appears that the called arg in the last functions is "node". On the user page the argument is "user". Does the problem comes from this bad arg?

Is there a solution to resolve this problem ? Is there another solution to render a submission ?

Thanks for your help.

kumkum29’s picture

Category: Support request » Bug report
Priority: Normal » Major
kumkum29’s picture

Title: Render of the submissions on the user page » Render submissions on the user page
kumkum29’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Fixed
kumkum29’s picture

I have found the solution.
In a specific component I have developped a custom behavior (conditions on the component). But I had problems in the code of my function. Then, I get the "EntityMalformedException:" message.

Now, it's resolved.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.