Page 1 of 1

FEU, passing smarty variables, UDT

Posted: Fri Nov 20, 2009 10:30 pm
by suthex
Having an issue with FEU Module, perhaps I am really having a PHP/Smarty issue, would appreciate some kind reflection ...

I have an enrollment form that upon submit calls index.php?mact=FrontEndUsers,cntnt01,do_adduser,1

In modules\FrontEndUsers\action.do_adduser.php I added the following line to set the smarty variable with the input transferred from the user submitted form:

$smarty->assign('feu_user', $params['feu_input_username']);


Now where it gets interesting, I pass control forward to another page, which collects some credit card information and attempts to transmit information to the credit card processor, but I need a bunch of variables from FEU database, and create a transaction hash that I have to pass with the data, so I do it all in a UDT (I never wanted to edit the action.do_adduser.php but did so as a last resort) ... so my UDT follows:

global $gCms;
$smarty = &$gCms->GetSmarty();
$username = $smarty->get_template_vars('feu_user');
echo ('got the user name' . $username);
$feusers = $gCms->modules['FrontEndUsers']['object'];
$uid = $feusers->GetUserID($username);
$properties = $feusers->GetUserProperties($uid);
foreach($properties as $key=>$value) {
    if ($value["title"] == "country") {
        $country = $value["data"];
    }
    if ($value["title"] == "Payment_Cycle") {
        $batchday = $value["data"];
    }
    if ($value["title"] == "firstname") {
        $first_name = $value["data"];
    }
    if ($value["title"] == "lastname") {
        $last_name = $value["data"];
    }
}


But, my echo is blank, and obviously my $feusers->GetUserProperties($uid) blows up ...

So any thoughts as to why when I try to get the $smarty variable that I set in the PHP that its blank?

Thanks
Doug

Re: FEU, passing smarty variables, UDT

Posted: Mon Jan 04, 2010 11:33 am
by nalat
I have the same problem.
What's the solution?
Thanks

Re: FEU, passing smarty variables, UDT

Posted: Mon Jan 04, 2010 1:53 pm
by Peciura
Have you considered module "CustomContent"?
http://forum.cmsmadesimple.org/index.ph ... #msg189991

{RESOLVED] Re: FEU, passing smarty variables, UDT

Posted: Sat Feb 06, 2010 5:55 am
by suthex
Thanks for the guidance ... in the end ... bad coding on my part ...

global $gCms;
$username = $gCms->smarty->get_template_vars('feu_user');

worked like a charm.