Forums

How to put user info into the form fields?

Cybervizor 09 Apr, 2012
Hi!
I have Joomla 2.5 based site with CF4.
Please help me to put user's info (name, address, phone and others) into form as default values.
The form is used by registered users only.
Thanks! )
GreyHead 10 Apr, 2012
Hi Cybervizor,

If you just want Username and Email then please search here on 'getUser' and you will find dozens of posts with similar questions.

If you want all of the User info then I have a custom Load User info [GH] action you can download and install.

Bob
Cybervizor 10 Apr, 2012
Thank you.

I've already installed Load User info [GH] action, but I cant get additional information (such as phone, address, city, postcode etc.), only name, username, email.
GreyHead 10 Apr, 2012
Hi Cybervizor ,

Ah, that action only gets information from the #__users table, where are you storing the other information? If it is in the User Profile then I'm sorry but I don't know how to access that.

Bob
Cybervizor 10 Apr, 2012
Hi, GreyHead!
It stores in #_user_profiles.
May be you know how to get it by DB Record Loader or DB Multi Record Loader?
Thanks.
GreyHead 10 Apr, 2012
Hi Cybervizor,

That's probably possible but I don't know how. Can you find any Joomla! documents that describe how user profiles work? I don't think that it is a simple flat table?

Bob
dariegler 26 Apr, 2012
im also looking for an example of how to display in form and send email to user that is logged in. i loaded the action described but do not know how to get the information.
thanks
dave
GreyHead 26 Apr, 2012
Hi Dave,

What information do you want to use. If it is from the standard Users table then the earlier posts apply; if it's from the profiles table I still don't know.

Bob
dariegler 26 Apr, 2012
All I want is the email address from the current user to add to the send mail function
dave
GreyHead 27 Apr, 2012
Hi Dave,

Add a Custom Code action to the On Submit event, drag it up before the Email action and put this code into it:
<?php 
$user =& JFactory::getUser();
$form->data['user_email'] = $user->email;
?>

Put user_email in the Dynamic To email box.

Bob
dariegler 27 Apr, 2012
great that worked... thanks much
dave😀
This topic is locked and no more replies can be posted.