• 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: Auto fill in name of logged in user to name field

Auto fill in name of logged in user to name field 13 years 7 months ago #14833

  • marcovis
  • marcovis's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Dear all,

I'm trying to auto-fill the name of the logged in user in the name field of a form. To do this, I've entered this code in de default value of the name field:
$user =& JFactory::getUser(); echo $user->name;

This doesn't work: it litteraly shows this code in the form.

What am I doing wrong a/o how can I fix this?

Kind regards,
Marco Visser
The administrator has disabled public write access.

Re: Auto fill in name of logged in user to name field 13 years 7 months ago #14859

  • praes
  • praes's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 2
Try this instead of your code:
{global:username}

Works for me.

Regards, Jelger
The administrator has disabled public write access.

Re: Auto fill in name of logged in user to name field 13 years 7 months ago #14866

  • webcat-solutions
  • webcat-solutions's Avatar
  • OFFLINE
  • Junior Boarder
  • Dutch Joomla specialist
  • Posts: 29
  • Thank you received: 4
Just checking: did you use the code specifiers?
example:
//<code>
 $user =& JFactory::getUser(); echo $user->name;
//</code>

gr,
Chantal
Last Edit: 13 years 7 months ago by webcat-solutions. Reason: error in code
The administrator has disabled public write access.

Re: Auto fill in name of logged in user to name field 13 years 7 months ago #14874

  • mel65
  • mel65's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Here is the correct code to use:

//<code>
$rsuser=JFactory::getUser();
$user=$rsuser->get('name');
return $user;
//</code>

Here it explains it:

www.rsjoomla.com/support/view-article/77...n-form-is-shown.html
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!