Can't load user information into form fields

morphz 02 Mar, 2018
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..
Max_admin 03 Mar, 2018
Answer
1 Likes
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.