Access to pages when login [MOVED]

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
Charmie
Forum Members
Forum Members
Posts: 80
Joined: Tue Mar 03, 2009 3:32 pm

Access to pages when login [MOVED]

Post by Charmie »

Hi,

Can anyone tell me if this is possible:
I would like to hide some pages and only have them seen by a few people after they have logged in?

For example the general public will see 5 pages but I would like once logged in two extra pages appear, is this possible and how would I do this?

Thanks
Last edited by Charmie on Thu Apr 09, 2009 9:30 am, edited 1 time in total.
alby

Re: Access to pages when login

Post by alby »

Charmie wrote: For example the general public will see 5 pages but I would like once logged in two extra pages appear, is this possible and how would I do this?
Use FronEndUsers and CustomContent modules for login and different view (public and logged)
Add in alias of your private pages a prefix priv- and use excludeprefix="priv-" in menu tag for general public
Search in forum for examples (maybe there is a Visual tutorial also)

Alby
Charmie
Forum Members
Forum Members
Posts: 80
Joined: Tue Mar 03, 2009 3:32 pm

Re: Access to pages when login

Post by Charmie »

Wow...thank you....thank you...I will try it out.

Just another question, how secure is this?
The pages I want to hide will list members information such as names, address, DOB (no credit card details or anything), just user information.
As I work as a Church leader some of the information will contact information of the children Sunday school as weed to keep records of things such as doctors, allergies, who to contact in an emergency also birthdays etc....

The parents would like to know how secure this information will will, does anyone know?

Thanks again.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Access to pages when login

Post by RonnyK »

Charmie,

you could/should have some logic in the template like....
        {cms_module module=CustomContent}
        {if $ccuser->loggedin()}
        {title}
        {content}
        {else}
        {global_content name='noaccess'}
        {/if}
to make sure that when a user isnt logged in, and tries to access the page directly, that he/she is redirected to a no-login-page...
In the example above, I used a GCB to hold the "You havent logged in, this page is off limits." with a title.


Ronny
Charmie
Forum Members
Forum Members
Posts: 80
Joined: Tue Mar 03, 2009 3:32 pm

Re: Access to pages when login

Post by Charmie »

Hi,

Thanks for all the advice especially the visual tutorials.

I have a few more questions on the matter.
I have two sections that are hidden from general users and are only accessible to members with logins.
How do I separate the logins so that depending on your log in you can see either the Gateway section, the praise Worship section or both?
I have created three groups, Gateway, Praise Worship and All.

Also I have added this code to template:
======================================


{cms_module module='FrontEndUsers' form='logout'}

{cms_module module='FrontEndUsers' form='login'}

======================================

I wanted the log in form to disappear once user has logged in and a message to say 'Welcome...etc..'.
but it does not seem to work, anyone know what I am doing wrong?
Also how can I allow Users to login using an assigned User name rather then their emails?

I know I am asking a lot, really hope someone can help.

Thanks
alby

Re: Access to pages when login

Post by alby »

Charmie wrote: Also I have added this code to template:
======================================


{cms_module module='FrontEndUsers' form='logout'}

{cms_module module='FrontEndUsers' form='login'}

======================================
1. Acc... this code not work because is DEPRECATED. Look in module help for examples with $ccuser sintax
2. For separate menu text re-read my post and use different prefix for Gateway and Praise Worship
3. Username can be a normal username or an email address

Alby
Charmie
Forum Members
Forum Members
Posts: 80
Joined: Tue Mar 03, 2009 3:32 pm

Re: Access to pages when login

Post by Charmie »

Hi,

Thanks for all the advice and I am nearly there.
So far using your help I have changed it so that Users can use a username and not their email...thanks.

I have given different alias to two sections 'Private_Gateway_' and 'Private_Praise_'
and have put this code into my template:
========================
   
                {if $ccuser->loggedin() && $ccuser->memberof('Gateway') }
                        {menu template='cc_simple_navigation' number_of_levels='1' includeprefix="Private_gateway_"}
                  {elseif $ccuser->loggedin() && $ccuser->memberof('Praise Worship')}
                          {menu template='cc_simple_navigation' number_of_levels='1' includeprefix="Private_Praise_"}
                {else}
                        {menu template='cc_simple_navigation' number_of_levels='1' excludeprefix="Private_gateway_,Private_Praise_"}
                {/if}
========================
But what seems to happen now is that if a member of Gateway logs i n they only see the Gateway menu heading and none of the others and the same for the Praise Worship members. rather then seeing the normal menu items including the extra one for their group.
Please someone I know i am close....

Also another thing is that the members have to log in twice and once logged in I have been able to get a message to appear....saying Welcome 'user name', but once you click to any other page on the site this message disappears and the login form appears again.
also the extra page that you gained access to...ie the gateway page disappears from the top menu...this is the code I have written for the login form:

==========================
{if $ccuser->loggedin() && $ccuser->memberof('Gateway') }
      Welcome {$ccuser->username()}
{else}
      {cms_module module=FrontEndUsers}
{/if}
==========================

Also how do I allow a user to log out?

I know a lot of question, sorry but am really struggling with this.

Thanks
Charmie
Forum Members
Forum Members
Posts: 80
Joined: Tue Mar 03, 2009 3:32 pm

Re: Access to pages when login

Post by Charmie »

Hi,

I think I may have solved this.
For the top level menu I used reverse logic as the 'includeprefix' only allows you to view the pages with the requested alias'

So my code to the top menu now looks like this:
=================================

      {if $ccuser->loggedin() && $ccuser->memberof('Gateway') }
          {menu template='cc_simple_navigation' number_of_levels='1' excludeprefix=Private_Praise_}
    {elseif $ccuser->loggedin() && $ccuser->memberof('Praise Worship')}
          {menu template='cc_simple_navigation' number_of_levels='1' excludeprefix=Private_gateway_}
    {else}
          {menu template='cc_simple_navigation' number_of_levels='1' excludeprefix="Private_gateway_,Private_Praise_"}
      {/if}

=================================

Also as for the log in and log out, I read the module help and have added the required parameter. i also reversed the check for logged in members so my code now looks like this:
==================================

      {if $ccuser->loggedin() == false}
            Please log in to access site
            {cms_module module=FrontEndUsers nocaptcha="1"}
      {else}
            {cms_module module=FrontEndUsers name='logout' returnto="home.html" }
      {/if}

==================================
This also displays a welcome message and re-directs the user to the home page after log out


Once again thanks for all your help, guys.
Charmie
Forum Members
Forum Members
Posts: 80
Joined: Tue Mar 03, 2009 3:32 pm

Re: Access to pages when login

Post by Charmie »

Hi,

Not sure what went wrong..... ???

This was working but now it isn't...
I have taken off the solved token but will re-post in the modules section as have realised that this is to do with the FEU Module and not about installation and set-up
Locked

Return to “[locked] Installation, Setup and Upgrade”