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.

if Logged in multiple member groups

March 14, 2012 10:15am

Subscribe [4]
  • #1 / Mar 14, 2012 10:15am

    stevo_s

    176 posts

    This question may be related to a resolved thread.

    How do I specify multiple member groups to check if if they are logged in?

    this produces errors -

    {if logged_in_member_group == "1" OR logged_in_member_group == "5" OR logged_in_member_group == "6" OR logged_in_member_group == "7"}Welcome {username} {/if}

    also is it possible to print their firstname ( am member field)rather than username?

     

  • #2 / Mar 15, 2012 9:34am

    stevo_s

    176 posts

    Any ideas on this ? doesn’t seem to work. Something wrong in my syntax?

    {if logged_in_member_group == “1” OR logged_in_member_group == “5” OR logged_in_member_group == “6” OR logged_in_member_group == “7”}Welcome {username} {/if}

  • #3 / Mar 15, 2012 11:16am

    glenndavisgroup

    436 posts

    Hi stevo_s,

    Try the following:

    {if logged_in AND (member_group == “1” OR member_group == “5” OR member_group == “6” OR member_group == “7”)}
    Welcome {username}
    {/if}

    Thank you,

    Mike

  • #4 / Mar 15, 2012 12:27pm

    Shane Eckert

    7174 posts

    Hello stevo_s,

    Please try our Mike’s suggestion. Checking to see if user is logged in first should do it.

    Please let us know how it goes.

    Cheers,

  • #5 / Mar 15, 2012 3:26pm

    stevo_s

    176 posts

    I just get this error -

    expressionengine/libraries/Functions.php(656) : eval()‘d code on line 61

    {if logged_in AND (member_group == "1" OR member_group =="5")} Welcome {username} {/if}Welcome {username}

     

  • #6 / Mar 15, 2012 3:29pm

    cbad

    60 posts

    Please try our Mike’s suggestion. Checking to see if user is logged in first should do it.

    I’m wondering why checking to see if the user is logged in is needed. If they aren’t logged in, wouldn’t their member group be set to 3 anyway (guest)?

    Just want to be sure I’m not missing something that could cause grief (I’ve checked for member_group alone before and it seemed OK).

    Thanks!

  • #7 / Mar 15, 2012 3:32pm

    stevo_s

    176 posts

    Are there problems pasting into a text editor from the ee forum on mac?
    I always seem to end up with curly quotes and odd spaces.


    member_group == “1”

    Should there be a blank space between member_group and ==
    and between == and “1” ?

  • #8 / Mar 15, 2012 3:34pm

    stevo_s

    176 posts

    I’m wondering why checking to see if the user is logged in is needed. If they aren’t logged in, wouldn’t their member group be set to 3 anyway (guest)?

    well the idea as suggested from the related thread is for a bit of security that even if someone did hack in, the CP access would only be seen by member groups that have access.

  • #9 / Mar 15, 2012 3:46pm

    stevo_s

    176 posts

    Seems to be working - I just had to retype the suggested code.
    Does the EE forum place invisibles in code that is pasted?

  • #10 / Mar 15, 2012 4:18pm

    glenndavisgroup

    436 posts

    Hi stevo_s,

    I’m glad it’s working for you. It’s always a good idea to try and type the code your self. I might have added something extra in there by accident. You can try copying and pasting to a simple text editor which should remove any unwanted characters. But to be safe try typing it in manually.

    Mike

  • #11 / Mar 16, 2012 4:51pm

    Shane Eckert

    7174 posts

    Hey stevo_s,

    I am glad that this is working now. Thanks for the assists Mike.

    Have a great weekend guys.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases