HI

My webform is working perfectly fine.

How can I add a component (name) filled by the user in the confirmation message?

I want the confirmation message on one of my webform as -
Thanks <%username> for registering.

I tried adding the following code to my webform-confirmation-[nid].tpl.php,

<?php
$temp_submission = webform_menu_submission_load($sid, $node->nid);
echo "Thanks" . $temp_submission->data[1]['value'][0];?>

But this is not working.

I would appreciate any help.

Thanks!

Comments

sej123’s picture

username is my 1st component.

I have really tried hard and researched a lot.

Please help me!

beautifulmind’s picture

Are you sure $temp_submission->data[1]['value'][0]username?

Try this

$om__user = user_load($node->uid);
echo "Thanks" . $om__user->name ." ". t("for registering");

Regards.
[edit] unwated char removed.

Regards.
🪷 Beautifulmind

sej123’s picture

Hi Thanks for the code!

However, this is not working in my case!

Can you please provide me any guidance!

beautifulmind’s picture

What's exactly not working?

Regards.
🪷 Beautifulmind

sej123’s picture

I have put the following code in my webform-confirmation-37.tpl file -

<?php
$om__user = user_load($node->uid);
echo "Thanks" . $om__user->name ." ". t("for registering");
?>

This is not giving the desired message, not even the default Thank you message.