I have a standard if/else statement that even when it is negative for the code to be run, a part of the code still runs.
This should only run the channel entries code IF the user is logged in, and belongs to the specific member group.
However, when logged out, it runs the “redirect” code below regardless. If I remove the redirect code it works fine, but I want that to work. Am I missing something or is this a bug?
Here it is
{if logged_out}
Show log in form
{if:elseif member_group != 5 }
Show error message for not being part of member group
{if:else}
{exp:channel:entries channel="channel_name" admin_id="CURRENT_USER" limit="1"}
{if no_results}
{redirect="path/here"} <-- this runs if not logged in ????
{/if}
other code
{/exp:channel:entries}
{/if}
Try it with logged_in_group_id instead of member_group a la:
{if logged_out}
Show log in form
{if:elseif logged_in_group_id != 5 }
Show error message for not being part of member group
{if:else}
{exp:channel:entries channel="channel_name" admin_id="CURRENT_USER" limit="1"}
{if no_results}
{redirect="path/here"} <-- this runs if not logged in ????
{/if}
other code
{/exp:channel:entries}
{/if}
That work?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.