Help with Custom Content

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
sing2trees
Forum Members
Forum Members
Posts: 38
Joined: Thu May 28, 2009 9:00 pm

[SOLVED] Re: Help with Custom Content

Post by sing2trees »

dendle wrote: Hi All,

I have just mocked up this thread in my CMSMS Test Installation and produced the same error.  As a test I put the if then else code within the body tags of the document template rather than wrapping around the whole document.  This technique works very well, first time every time.

A quick note, I use both the $ccuser-->loggedin() and the $ccuser->memberof(GROUPNAME)  conditions as $ccuser seems to return true even if no-one is logged in (it seems to treat no-one logged in as an anonymous user).  Please let me know if this understanding is not correct.  As a note, without using $ccuser group to check the user the page will let anyone in (authenticated or otherwise).  

Having said that this technique does work for me, and I am interested in others thoughts and if it helps......
I am running CMSMS 1.5.4; PHP 5.2.8; MySQL 5.0.77-community and Apache 2.2.11 running under a linux kernel 2.6.18-19.el5
IE:

Code: Select all

<__html>
</__body>
{if $ccuser-->loggedin() && $ccuser->memberof(Clients)}

....content of page if user is logged in.
{cms_module module='FrontEndUsers' form='logout}
{else}
{redirect_page page='client'}
{/if}
<__body>
</__html>
Final note, do not use this template for the login page (it will cause a recursive loop).  My solution was to implement the if then else statement directly in the code of the login page itself, it looks something like this:

Code: Select all

{if $ccuser->loggedin() && $ccuser->memberof(Clients)}
{redirect_page page='client-home'}
{else}
Please use the form below to login<br />
{cms_module module='FrontEndUsers' form='login'}
{/if}
This works a treat! Many thanks!!!
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Help with Custom Content

Post by Jeff »

Dendle: You are not correct about being logged in as anonymous, I believe it is always returning true because you have $ccuser-->loggedin() it should be $ccuser->loggedin()
User avatar
dendle
New Member
New Member
Posts: 7
Joined: Mon Jun 01, 2009 10:05 pm

Re: Help with Custom Content

Post by dendle »

Many thanks you are correct, my bad on the code.  It should be -> not --> as I have indicated......
-- if the facts dont fit the theory, change the theory--
Post Reply

Return to “Modules/Add-Ons”