Page 1 of 1

getting {if $ccuser->loggedin()} to work in User Defined Tags

Posted: Thu Nov 13, 2008 6:13 am
by perseus
Hi
I'm running the newest version of CMS (1.4.1) and FrontEndUser 1.4.2. With FrontEndUser you can use the tag {if $ccuser->loggedin()} in a template or on the page it self. I was wondering if there is any way of using the tag in a User defined tag.
I have multiple menus that depends on if you are logged in or not, and what you are logged in as ($ccuser->memberof('Admin')).

The menus are the same on all my templates but they change with time. I like to be able to use a User defined tag to set everything up and then just use the same tag on all templates and when I change the menus I only do it in the User defined tag.

I have found how you can make tags like {menu} to work from a User defined tag:

$smarty = &$gCms->GetSmarty();
$smarty_data = "{menu}";
$smarty->_compile_source('temporary template', $smarty_data, $_compiled );
@ob_start();
$smarty->_eval('?>' . $_compiled);
$_mainmenu = @ob_get_contents();
@ob_end_clean();

But the {if} expression doesn't seem to work the same way. So how can I solve this. Can I add the value of $ccuser->memberof('Admin') and $ccuser->loggedin() in the call to my user defined tag. Or can I somehow (in similar way as with the {menu} tag) be able to code the whole {if $ccuser->loggedin()} tag so that it reads in on the page as the "if" was written on that page and the iff would work and the $ccuser->loggedin() value would be there. 

Can it be done or not?

Hope people understand my question.
Thank you for your help
Henrik

Re: getting {if $ccuser->loggedin()} to work in User Defined Tags

Posted: Thu Nov 13, 2008 8:16 pm
by jmcgin51
I have done exactly what you want to do.  Use a Global Content Block instead of a UDT, if you want to use Smarty. 

See this post: http://forum.cmsmadesimple.org/index.ph ... 066.0.html