Buy Now
Sign in

Can't load user information into form fields

morphz , March 02 at 14:58
Answered
M
morphz
Hello
I read this guide.
I added Logic -> PHP to the beginning of the event
<?php
$user = \JFactory::getUser();
?>
I get "syntax error, unexpected '<', expecting end of file"
removing <?php ?> shows the article but I do not get any output of the user information in the debugger. (because obviously(not obvious) <?php ?> is needed)!
Array
(
[90d11bbf539a428fbe29e7fd3103a994] => 03713cb9ae2a8dcc7685c4a06d5904fc
[cbrvs] => cbrv1_9da7ab8994f1baf0339ee0f0fb520cf1_hOGfQfhhYpYQwFBc
[aef27140db7210fbf793f9cdb818be07] => f7621b7082ac8dfd45727eda60581f8d
[joomla_user_state] => logged_in
[Itemid] => 177
[option] => com_content
[view] => article
[id] => 35
[place-offer] =>
)
Array
(
[Get User] => Array
(
[returned] =>
[var] =>
)

)
All I want is to load the username of the logged in user to the value of a text field. I am not an expert but also not a newbie. The tutorial is outdated or too hard to comprehend. Any help appreciated..
admin
Hi morphz,
Yes, that's a v4 FAQ, in v6 you can load the user info easily using shortcodes:
{user:username}
in the field value box!
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!