Using info via php from AjaxRegister
- lsmac
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
10 years 10 months ago #7256
by lsmac
I created a few new fields with AjaxRegister to help out in identifying my clients abit more 'personally'. Additional fields are firstName, lastName, companyName, but I am having trouble accessing the info.
I know that in Joomla I can access the username via php with this statement:
<?php $user =& JFactory::getUser(); $userName = $user->get( 'name' ); if ($user->get('guest') == 1) {echo "Greetings, welcome to our great website!"; } else { echo "Greetings ".$userName.", welcome to our great website!"; } ?>
But, what I want to do is echo the firstName field from AjxRegister, rather than username from Joomla profile.
Can anybody help me out with the proper PHP code? It's all Greek to me, as I am a graphic artist, not a programmer...LOL
Any help is appreciated,
Scott
I know that in Joomla I can access the username via php with this statement:
<?php $user =& JFactory::getUser(); $userName = $user->get( 'name' ); if ($user->get('guest') == 1) {echo "Greetings, welcome to our great website!"; } else { echo "Greetings ".$userName.", welcome to our great website!"; } ?>
But, what I want to do is echo the firstName field from AjxRegister, rather than username from Joomla profile.
Can anybody help me out with the proper PHP code? It's all Greek to me, as I am a graphic artist, not a programmer...LOL
Any help is appreciated,
Scott
Please Log in or Create an account to join the conversation.
- Saka
- Offline
- Administrator
10 years 10 months ago #7257
by Saka
Emir Sakic
www.sakic.net
Hello,
The extra fields are attached to the user object so they can be accessed via:
For example, to access your field with label companyName you will do it with:
The extra fields are attached to the user object so they can be accessed via:
$user = JFactory::getUser();
print_r($user->extra);
For example, to access your field with label companyName you will do it with:
$user->extra['companyName'];
Emir Sakic
www.sakic.net
Please Log in or Create an account to join the conversation.