Page 1 of 1

broken layout with { if $ccuser->loggedin() }

Posted: Fri Feb 18, 2011 6:09 pm
by whitebean
Hi

I am running CMSMS 1.9.3 on PHP Version 5.3.5. I have everything set up and working but am running into problems using the frontenduser() module. I have it all set up so that the user logs in and is redirected to a content page, but I want to make the content page invisible to the none logged in users. Currently on the page I have

{ if $ccuser->loggedin() }
show content or do a redirect
{else}
<p>This is a private area.</p>
{cms_module module=FrontEndUsers form="login" nocaptcha="1" returnto="$current-volunteer-login"}
{/if}

placed in the content area (I also have WYSIWYG disabled). Trouble is it seems that the { if $ccuser->loggedin() } command is breaking the layout. The page is loading, but not displaying the login box or the appropriate content and it looks like the style sheet is not working, so only a partial page. If I take out all the smarty commands, but leave the {cms_module module=FrontEndUsers form="login" nocaptcha="1" returnto="$current-volunteer-login"} it works. Any ideas? Am I making sense? I have tried to look everywhere for the answer, so please forgive me if I have made a simple error.

Re: broken layout with { if $ccuser->loggedin() }

Posted: Fri Feb 18, 2011 6:48 pm
by Dr.CSS
When you say you have tiny disabled, do you mean you turn it off then add the code?...

If so tiny does come back on for a split second when you hit submit, either set tiny to not start on page load or just hit apply and go to another part of the admin, hit apply then hit the Content link in the top menu, this will get you out of that page edit w/o letting tiny come back on, but the next time you edit that page it will eat your code...

Tiny tends to turn > into &grt; is most likely why it messes with the layout...

Re: broken layout with { if $ccuser->loggedin() }

Posted: Fri Feb 18, 2011 7:50 pm
by whitebean
Thanks for the quick response.

In the options tab on the Edit content page I have disabled the checkbox with "Disable WYSIWYG editor on this page (regardless of template or user settings):
"

I think my next path of action will be to try to put the smarty command into template rather than the page content and see if I have successs with that. It's probably a better way of doing it anyway.

Re: broken layout with { if $ccuser->loggedin() }

Posted: Fri Feb 18, 2011 8:17 pm
by whitebean
Arghh! right I have found the problem. I did not have the Custom Content module installed, I thought I had -but it seems to have gone. have now installed have success.

I think leaving the smarty commands in the template rather than the content is a good move though.

Re: broken layout with { if $ccuser->loggedin() }

Posted: Fri Feb 18, 2011 8:40 pm
by Dr.CSS
A lot of times I make a new template just for the login stuff, a copy of original, then put all the logic in them, like if not logged in redirect to page x etc. that way you can have specific menus for logged in uses, stuff like that...