referencing customcontent in user defined tag?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
sabernar

referencing customcontent in user defined tag?

Post 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.
Last edited by sabernar on Sat Jul 01, 2006 9:52 pm, edited 1 time in total.
sabernar

Re: referencing customcontent in user defined tag?

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: referencing customcontent in user defined tag?

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
sabernar

Re: referencing customcontent in user defined tag?

Post by sabernar »

That was the first thing that I tried.  Could you give me a quick example?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: referencing customcontent in user defined tag?

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “CMSMS Core”