[Solved] Passing FrontEndUser user data to a FormBuilder form
Posted: Wed Dec 19, 2007 3:12 am
Hello,
My setup details - CMSMS: 1.2.2 FEU: 1.3.1 CustomContent: 1.4.10 FormBuilder: 0.4.4
I would like to pass the FEU user data (not just the customcontent_loginname) to a FormBuilder form so that the form is pre-loaded with the logged in user's details.
Aspects of this are covered in various posts and by using the excellent help provided by CalGuy1000 and others I have been able to come up with the following UDT to access the data I need:
-------------------------------------------------------------------------
global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
if( $feusers )
{
$uid = $feusers->LoggedInId();
$properties = $feusers->GetUserProperties($uid);
$firstname= ( $properties [1][data]);
$lastname= ( $properties [2][data]);
$email= ( $properties [3][data]);
$phone= ( $properties [4][data]);
echo $firstname . " " . $lastname . " " . $email . " " . $phone ;
}
-----------------------------------------------------------------------
So the information is there, I can access it, and (using the test 'echo' statement) I can display it correctly on a page. To pre-load the variables into a FormBuilder form I thought I should be able to use:
{cms_module module='FormBuilder' form='b_tempted' value_fld25= $firstname}
After all, as I have the variable $firstname echoing to the same page as the form I reasoned that it must be accessible. This does not seem to be the case though. I have tried many variations but no matter what I do I cannot seem to get $firstname to pre-load into the form. This would be an incredibly useful thing to be able to do.
If anyone can help with this I would be very grateful. Thanks in advance - Michael.
My setup details - CMSMS: 1.2.2 FEU: 1.3.1 CustomContent: 1.4.10 FormBuilder: 0.4.4
I would like to pass the FEU user data (not just the customcontent_loginname) to a FormBuilder form so that the form is pre-loaded with the logged in user's details.
Aspects of this are covered in various posts and by using the excellent help provided by CalGuy1000 and others I have been able to come up with the following UDT to access the data I need:
-------------------------------------------------------------------------
global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
if( $feusers )
{
$uid = $feusers->LoggedInId();
$properties = $feusers->GetUserProperties($uid);
$firstname= ( $properties [1][data]);
$lastname= ( $properties [2][data]);
$email= ( $properties [3][data]);
$phone= ( $properties [4][data]);
echo $firstname . " " . $lastname . " " . $email . " " . $phone ;
}
-----------------------------------------------------------------------
So the information is there, I can access it, and (using the test 'echo' statement) I can display it correctly on a page. To pre-load the variables into a FormBuilder form I thought I should be able to use:
{cms_module module='FormBuilder' form='b_tempted' value_fld25= $firstname}
After all, as I have the variable $firstname echoing to the same page as the form I reasoned that it must be accessible. This does not seem to be the case though. I have tried many variations but no matter what I do I cannot seem to get $firstname to pre-load into the form. This would be an incredibly useful thing to be able to do.
If anyone can help with this I would be very grateful. Thanks in advance - Michael.