ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

member _id is in member_group

August 24, 2010 10:18am

Subscribe [3]
  • #1 / Aug 24, 2010 10:18am

    foordie

    3 posts

    Hi,

    I am looking to create a condition where a user can only access content if the member_id is in a member_group. Been looking here and couldn’t see it listed.

    I know I can use the member_group on its own, but if a user manually changes the url,  to a different group type they get to see their content in the other profiles set up. So I want to check to see if the id is or isn’t part of the member group and there for direct them to the correct profile layout.

    For example if a user’s profile can be seen here…
    http://www.website.com/group_1/profile/12

    (Where 12 is the member_id)

    ...and they change the url to display group_2 then the users content gets displayed in the different profile…

    http://www.website.com/group_2/profile/12


    I’m using…

    {if member_group == '6'}  
    //content
    {/if}

    Is there something like:

    {if member_id is in member_group'6'}  
    //content
    {/if}
    {if member_id is NOT member_group'6'} 
    //Show this instead content
    {/if}


    Any ideas?

    Thanks
    Ben

  • #2 / Aug 24, 2010 7:32pm

    Brandon Jones

    5500 posts

    Hi Ben,

    As this is more of a How-to with multiple approaches, I’ll move this over to the CodeShare Corner in order to get you further input. Thanks.

  • #3 / Aug 25, 2010 6:04am

    Steven Grant

    894 posts

    Ben,
    You’re overcooking your conditional a little bit.

    You would get away with

    {if group_id == '1'}
    content
    {if:elseif group_id == '2'}
    more content
     {if:else}
    content
    {/if}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases