Page 1 of 1

access to FEUsers variables from another module

Posted: Wed Jan 17, 2007 1:36 pm
by numer9
Hey,
i want to alter the Calendar module so that I'll have the access to customcontent_loginname variables from inside of Calendar function. When I'm doing the $module dump, I see the data i want, but it's inside bunch of other arrays and stuff.

i coulndn't get to that var using $gCms['modules'] -> print_r of this gives me fatal error with malloc.

So: i'm inside a Calendar function that displays stuff for front-end, and I want to have access to {$customcontent_loginname} value (but not on the page, in the php code). Any programmers hints?

Re: access to FEUsers variables from another module

Posted: Wed Jan 17, 2007 2:25 pm
by calguy1000
Selfreg does stuff like this.

it essentially does a "$feusers = $this->GetModuleInstance('FrontEndUsers');
then calls methods from the frontend users api.

Re: access to FEUsers variables from another module

Posted: Wed Jan 17, 2007 4:09 pm
by numer9
that's exactly want i wanted to do - connect to another module like in selfReg. But it doesn't work - maybe it because of new module architecture?

i got the access by entering:

Code: Select all

	echo $module->cms->smarty->_tpl_vars[userid];
But your solution doesn't work. I got the function, similar to Calendar function "displaylist" (function.displaylist.php), that's starting with:

Code: Select all

function AddEventWorker(&$module, $id, &$parameters, $returnid)
{
	global $gCms;

//	print_r ($module->cms->smarty->_tpl_vars);
	echo $module->cms->smarty->_tpl_vars[userid]; // it works, but doesn't look nice
	
	$feusers = $module->cms->GetModuleInstance('FrontEndUsers'); // doesn't work, causes fatal error
        $feusers = $gCms->GetModuleInstance('FrontEndUsers');  // doesn't work, causes fatal error
}
am I missing something?