0

I've made 2 new Member Groups, Ouders and Kids. Both are base on the Members group.

I've a Template Group nieuws. Access for this index is only for Member Group Ouders.

I've a Template Group activities. Access for this index is only for Member Group Kids.

In my template nieuws/index I have this code:

 {if logged_in}

 {exp:channel:entries channel="nieuws" disable="categories|member_data"}
 .... 
{/exp:channel:entries}


 {/if}


 {if logged_out} 
{exp:member:login_form}
         <p> <label>gebruikersnaam</label><br> <input type="text" name="username" value="" class="formfield" maxlength="32" size="25">
         </p>
         <p> <label>wachtwoord</label><br> <input type="password" name="password" value="" class="formfield" maxlength="32" size="25">
         </p>

         <p><input type="submit" name="submit" class="button" value="LOGIN"></p>   
{/exp:member:login_form} 
{/if}

In my template activities/index I have this code:

{if logged_in}

{exp:channel:entries channel="activities" disable="categories|member_data"}
....
{/exp:channel:entries}


{/if}


{if logged_out}
{exp:member:login_form}
        <p>
<label>gebruikersnaam</label><br>
<input type="text" name="username" value="" class="formfield" maxlength="32" size="25">
        </p>
        <p>
<label>wachtwoord</label><br>
<input type="password" name="password" value="" class="formfield" maxlength="32" size="25">
        </p>

        <p><input type="submit" name="submit" class="button" value="LOGIN"></p>

{/exp:member:login_form}
{/if}

If I login with the username/password from a Kids Member Group I get access to both templates (nieuws and activities) when a Kids member should only have access to the activities template. If I login as a Ouders member I get access also to both template.

Am I doing something wrong or do I need an Add-on to achieve this.

Francois

  • Are you allowing the member to be logged in after registration? – Bhashkar Yadav Jun 4 '13 at 8:34
  • @BhashkarYadav I made a mistake in my message, I change it. Read "If I login with..." instead of "If I register..." Sorry for that. – worfoual Jun 4 '13 at 10:45
1

You can modify each of your conditionals surrounding the channel entries tag to include group info.

{if logged_in_group_id == '1' OR logged_in_group_id == '7'}
  <!-- Enter in correct id for member group, including any admin groups. -->
  {exp:channel:entries ...}
{/if}

You can also redirect someone who went to the wrong page. For example, if a logged in kid goes to the nieuws page, you can redirect them to the activities page by adding this to the nieuws template.

{if logged_in_group_id == '7'}{redirect="/activities"}{/if}
| improve this answer | |
  • Of course, it sound very logical. I still have so many things to learn, it keeps me young. Stephen, thanks a lot Francois – worfoual Jun 4 '13 at 13:28
  • Francois, glad it helped. – Stephen Callender Jun 4 '13 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.