How can I get value from custom field in Joomla 3.8.5?

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
justibatata2810
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Thu May 24, 2018 1:19 am
Contact:

How can I get value from custom field in Joomla 3.8.5?

Post by justibatata2810 » Sat Sep 15, 2018 1:46 am

I had created the new fields in User:Fields named departments, phone, and mobile phone. How can I view it at my site like how username and email can be viewed? For now I'm using getUser() and getParam(), but only name, username, and email appeared. Where can I get the field name in Joomla? Please excuse my knowledge as I'm very new to Joomla. Thank you.

$registered = JAccess::getUsersByGroup(2); //change number in the brackets
$rows = '';

foreach($registered as $user_id) //loop every user exist
{
echo "<br>";
$user = JFactory::getUser($user_id);

$rows .= '';
$rows .= '' . $user->name . '';
$rows .= '' . $user->username . '';
$rows .= '' . $user->getParam('com_fields_departments') . '';
$rows .= '' . $user->getParam('com_fields_phone') . '';
$rows .= '' . $user->getParam('com_fields_mobile_phone') . '';
$rows .= '' . $user->email . '';
$rows .= '';
}
echo $rows;
Last edited by imanickam on Sat Sep 15, 2018 3:42 am, edited 1 time in total.
Reason: Moved topic » from General Questions/New to Joomla! 3.x to Joomla! 3.x Coding

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17370
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: How can I get value from custom field in Joomla 3.8.5?

Post by toivo » Tue Sep 25, 2018 11:26 am

Did you copy and paste this topic from StackExchange? Plagiarism is strictly forbidden in the forum.

You should have tried the method from answer, provided at https://joomla.stackexchange.com/questi ... omla-3-8-5.
Toivo Talikka, Global Moderator


Locked

Return to “Joomla! 3.x Coding”