I need to set up a live review for new content. I’m hoping someone might be able to advise me on a better method as the current method I’m using is ugly from a maintenance point of view as I will be duplicating hundreds of lines of code. I can’t seem to find a way in EE that avoids duplicating code.
Currently I’m using member group ids and status to control access to pages:
{if member_group == "1" OR member_group == "7" OR member_group == "8"}
{exp:weblog:entries weblog="myweblog" status="Draft|Approved Internally|Approved Externally|Open"}
..Massive amount of code here
{exp:weblog:entries}
{if:else}
{exp:weblog:entries weblog="myweblog" status="Open"}
..Massive amount of the same code I'm duplicating again here. Meet maintenance hell!
{exp:weblog:entries}
{/if}I tried
{if member_group == "1" OR member_group == "7" OR member_group == "8"}
{exp:weblog:entries weblog="myweblog" status="Draft|Approved Internally|Approved Externally|Open"}
{if:else}
{exp:weblog:entries weblog="myweblog" status="Open"}
{/if}
..Massive amount of code here
{exp:weblog:entries}it seems that the member variables are parsed after the weblog tag so this fails and shows protected content to everyone
I also hoped this might work
{if member_group == "1" OR member_group == "7" OR member_group == "8"}
{assign_variable:protected_status="Draft|Approved Internally|Approved Externally|"}
{/if}
{exp:weblog:entries weblog="myweblog" status="{protected_status}Open"}
..Massive amount of code here
{exp:weblog:entries}this also fails and shows protected content to member groups outside of the ones specified
The main thing I want to avoid is duplicating big blocks of code. It would seem pretty simple - just a variable that needs to be set but I’m tearing my hair out!
Any ideas about how to do this without using two sets of weblog tags as per the first example?