Frontendusers/CustomContent/SelfRegistration and smarty problems

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
FinnK

Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by FinnK »

Hi all
I am running a small site  for a community of film editors, and I am converting existing pages to CMSMS. I need to restrict some pages just for groupmembers.

I have looked for modules making this possible and as I understand its the combination Frontendusers/CustomContent/SelfRegistration that is the valid solution for this now, not PunBB/Protected Pages anymore- right?

Frontendusers/CustomContent/SelfRegistration is installed into my cms0.13 site. It seems to work although selfregistrated users do not show up in the Self Registration Module user list - they show in FrontEndUsers.

I have read the help texts and the "Comments method" for CustomContent do work. But I cannot get the smarty-"way" of using CustomContent to work.  When I try to use smarty as shown in the helptext I only get a blank page or no content at all. Nor the "if-text" or "else-text" show.

What to do?

And can you suggest a way of displaying the username when logged in? It's nice to see  when you are logged in!

Please look at http://www.filmklippere.com/cms . -Work in progress - The pages "restricted" and "Testmemberpage" has customcontent working. You may try with UserId: test11 and pasw: 123456

...And how to get rid of the DEBUG-text at the top of the "restricted" page?

As you must have understood by now I am a newbie webmaster and would be very grateful for any help.

FinnK
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by calguy1000 »

Hi FinnK

Yes, Protected Pages is Deprecated, and here's the organization of the new modules.
    FrontendUsers provides login/logout stuff, change settings, and forgot password functionality
    CustomContent can use the information from logged in users (logged in with FrontendUsers) to display custom content to
        people based on their ip address, group memberships, or even username.
    SelfRegistration is a module that allows people to register themselves with FrontendUsers, once the registration process is
        complete, and they've finished the validation process the user information is added to FrontendUsers, and removed from
        Selfreg.

    There are two ways of using the custom content module, a) with comment tags, and b) with smarty tags.
    I didn't see an example of your customcontent logic in your page or template, so I can't say what mistake your making,
    however, make sure you have the latest svn version of the CustomContent module, as I have made some fixes to the
    smarty syntax stuff in custom content and have not been able to cut a release yet.

    But, here's an example of some customcontent code that works for me:

Code: Select all

{cms_module module=CustomContent}
{if $customcontent_loggedin eq 1}
Welcome, you are an authorized user<br/>
{else}
You are not logged in
{/if}
As far as the name of the logged in user, if you have the frontendusers tag somewhere
on your page, you should be able to get access to the username with a tag like {$username}
all of the other user properties are similarly exported to smarty.

Hope this helps.
FinnK wrote: Hi all
I am running a small site  for a community of film editors, and I am converting existing pages to CMSMS. I need to restrict some pages just for groupmembers.

I have looked for modules making this possible and as I understand its the combination Frontendusers/CustomContent/SelfRegistration that is the valid solution for this now, not PunBB/Protected Pages anymore- right?

Frontendusers/CustomContent/SelfRegistration is installed into my cms0.13 site. It seems to work although selfregistrated users do not show up in the Self Registration Module user list - they show in FrontEndUsers.

I have read the help texts and the "Comments method" for CustomContent do work. But I cannot get the smarty-"way" of using CustomContent to work.  When I try to use smarty as shown in the helptext I only get a blank page or no content at all. Nor the "if-text" or "else-text" show.

What to do?

And can you suggest a way of displaying the username when logged in? It's nice to see  when you are logged in!

Please look at http://www.filmklippere.com/cms . -Work in progress - The pages "restricted" and "Testmemberpage" has customcontent working. You may try with UserId: test11 and pasw: 123456

...And how to get rid of the DEBUG-text at the top of the "restricted" page?

As you must have understood by now I am a newbie webmaster and would be very grateful for any help.

FinnK





Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
FinnK

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by FinnK »

Now I am on the track again, thank you!

Apparently I am shamelessly ignorant about Smarty/php/cmsms programming (syntax). The code in the help text does not work:


The CustomContent helptext example:

Code: Select all

{cms_module module=CustomContent}
{if customcontent_loggedin}
  Welcome <b>{customcontent_loginname}</b><br/>
{/else}
  <h1>You are not authorized to view this data</h1>
{/if}
The code in your reply here:

Code: Select all

{cms_module module=CustomContent}
{if $customcontent_loggedin eq 1}
Welcome, you are an authorized user<br/>
{else}
You are not logged in
{/if}
-and since I have little knowledge on smarty/php programming I was not able to find the right coding. Like when to use "=" , when to use "eq"  or where to use "$" or not.

Can you recommend a site or something where I can get wiser on these things I need to know?

And one variables question:
with $customcontent_loggedin I get value "9" not "1" like in your suggested code - I thought this variable was boolean but apperantly not - what does it reflect?

CMSMS is a great -and so are all of you hard working coders that on top of this have to educate an ocean of amateurs. I am very grateful for your efforts.

FinnK
FinnK

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by FinnK »

I am really sorry, but there is something strange going on!

First it works - then it dont work even if NOTHING is changed. I have put  {$customcontent_loginname} into my footer to display  the status of the logged in user:

When not logged in it displays "nobody" - or most of the time nothing - completely random when jumping form page to page.
When logged in it displays the user name - or most of the time nothing -  completely random when jumping form page to page.

If I try to accsess one of the smarty restricted pages - when logged in - I may, or may not get to see the page.

The page controlled with CustomContent the comments-way do always work as intended. -But look at the {get_template_vars} displayed before customcontent is called when logged in and not logged in.

Seems to me that there is a problem of "reading" the correct value of the variable(s)?

My site again:  http://www.filmklippere.com/cms  login with user: test12 and pasw: 123456 Look at the footer, to the right of the link to the LOGOUT page the loginname should apperar as test12 - or nobody if not logged in. Most of the time nothing displays.

I run cms 0.13 - customcontent 1.4.1 - frontendusers 1.0.4 -

This is the content in page RestrictedSmarty:

Code: Select all

{get_template_vars}
<br /><br />
{cms_module module=CustomContent} <br /><br />
{if $customcontent_loggedin eq 9} <strong>Welcome, you are an authorized user {$customcontent_loginname} </strong><br /> 
{else} 
<br />You are not logged in <br />
{/if}
This is the content in page Restricted:

Code: Select all

{cms_module module=CustomContent}
{if $customcontent_memberof_nfkmedlem eq 1}<br /><br /> 
Welcome, you are an authorized user nfkmedlem<br /> 
{else} <br /><br />
You are not logged in <br /><br />
{/if}
This is the content for page TestMemberpage:

Code: Select all

{get_template_vars}
{cms_module module=CustomContent}
<!--customContent: startif group=nfkmedlem -->
<H1>This content shows only for logged in nfkmedlem</H1>
<!--customContent: else -->
<H1>This content is available to everybody else</H1>
<!--customContent: endif -->
All this is very mysterious to me...
FinnK

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by FinnK »

Mystery solved !? - or at least a solution found.

I have no problem with CustomContent Smartys when I turn off "Cachable" in the options for a page.

Then I checked config.php to see if this was an option for the whole site. I couldn't find anything about this there, BUT I found this:

Code: Select all

#CMS Made Simple Configuration File
#Please clear the cache (Site Admin->Global Settings in the admin panel)
#after making any changes to path or url related options
I did this and now it seems to work with or without Cachable turned off.

Happy days are here again...
FinnK

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by FinnK »

SORRY

but turning "Cachable" off for every page is the only stable way of using CustomContent Smartys for me.

How do I turn Cachable of as default?
ladytron

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by ladytron »

FinnK wrote: SORRY

but turning "Cachable" off for every page is the only stable way of using CustomContent Smartys for me.

How do I turn Cachable off as default?
To turn Smarty caching off, open the "index.php" file located at the root of your site (not in the admin part), and add

Code: Select all

$smarty->caching = false;
just below line 71 or 72.

It should avoid using Smarty's integrated caching system ;)
rhys
Forum Members
Forum Members
Posts: 40
Joined: Thu Nov 24, 2005 4:16 pm

Re: Frontendusers/CustomContent/SelfRegistration and smarty problems

Post by rhys »

how do I get rid of the DEBUG-text at the top of the "restricted" page?
FinnK wrote:
...And how to get rid of the DEBUG-text at the top of the "restricted" page?

Locked

Return to “CMSMS Core”