Hi,
i would like to create a name field that is autofill the name using users name/id when they are logged in.
How can i do that?
i would like to create a name field that is autofill the name using users name/id when they are logged in.
How can i do that?
Hi.
I have read the FAQ many times but cannot get this to work. I admit I am a bit green so I am probably missing something obvious.
This is what I attempted:
Entered the forms Editing page and selected 3. Setup - select from functions.
In the 'Submit' tab area I dragged a Custom Code action box and positioned it before the 'Save Data' action box.
In this box I placed this code to try to call the users name from the Joomla database (tis code is probably wrong)
<?php
$user = \JFactory::getUser();
$form->data['user_id'] = $user->name;
?>
Saved and exited the editor to open the Database editor and 'Modify table' page.
Then I toggled on the 'user_id table field and saved the table.
All I get is the user_id number...
Please advise.
I have read the FAQ many times but cannot get this to work. I admit I am a bit green so I am probably missing something obvious.
This is what I attempted:
Entered the forms Editing page and selected 3. Setup - select from functions.
In the 'Submit' tab area I dragged a Custom Code action box and positioned it before the 'Save Data' action box.
In this box I placed this code to try to call the users name from the Joomla database (tis code is probably wrong)
<?php
$user = \JFactory::getUser();
$form->data['user_id'] = $user->name;
?>
Saved and exited the editor to open the Database editor and 'Modify table' page.
Then I toggled on the 'user_id table field and saved the table.
All I get is the user_id number...
Please advise.
Hi Razorr,
If you have v6 then all you need to do is to write {user:id} or {user:username} in the "Value" setting of your field, no need for extra code or actions.
Best regards
If you have v6 then all you need to do is to write {user:id} or {user:username} in the "Value" setting of your field, no need for extra code or actions.
Best regards
This topic is locked and no more replies can be posted.
