Page 1 of 1
referencing customcontent in user defined tag?
Posted: Sat Jul 01, 2006 9:50 pm
by sabernar
I am creating a custom form handler for a very specialized form, and I want to reference some customcontent information (i.e. loginname, etc.) inside the user defined tag that will be displaying the form (i.e. prefilling user information like first name, last name, username, etc.). How do I do this?
Thanks.
Re: referencing customcontent in user defined tag?
Posted: Mon Jul 03, 2006 2:59 am
by sabernar
Well, I went and did this:
global $gCms;
$cc = $gCms->modules['FrontEndUsers']['object'];
$fname = $cc->GetUserProperty('cfirstname');
and it works just fine. It seems like there should be an easier way, but I wasn't able to find it.
If anyone has any better methods to accomplish this, I'd love to hear them.
Re: referencing customcontent in user defined tag?
Posted: Tue Jul 04, 2006 2:46 pm
by calguy1000
If you are using a user defined tag, then no, this is the defined way of doing things:
a) get a reference to a module instance
b) use the module's API (if it has one that is sufficient) to extract
data that you need.
If you had been doin this in you template, then customcontent and frontendusers export variable such as this to smarty for you already.
Re: referencing customcontent in user defined tag?
Posted: Wed Jul 05, 2006 10:22 pm
by sabernar
That was the first thing that I tried. Could you give me a quick example?
Re: referencing customcontent in user defined tag?
Posted: Thu Jul 06, 2006 2:48 am
by calguy1000
Code: Select all
global $gCms;
$feusers =& $gCms->modules['FrontEndUsers']['object'];
$userid = $feusers->LoggedInId();
$fname = $feusers->GetUserProperty('cfirstname');
The api is all in frontendusers.api.php so you should see the functions you need in there.