• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Use the user name in a field

Use the user name in a field 5 years 6 months ago #39557

  • agrepe
  • agrepe's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
Hello,
I need to pre-fill the "name" field of my form with the name of the logged in user.
I tried to put the following code in the "Additional Attributes" field:

<? Php
$ user = &JFactory::getUser ();
echo $user->name;
 
?>

But it does not work, does anyone know how to do it?

Best regards
The administrator has disabled public write access.

Use the user name in a field 5 years 6 months ago #39561

  • gregs
  • gregs's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 85
  • Thank you received: 5
Try this:

//<code>
$user = JFactory::getUser();
return $user->get('name');
//</code>
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!