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.

How to dynamically change the status parameter of a channel entries tag based on member group?

January 17, 2013 3:58pm

Subscribe [1]
  • #1 / Jan 17, 2013 3:58pm

    MadWebDesigns

    147 posts

    Hey Peeps,

    Happy New Year!

    I’m currently using EE 2.5.2 and I’m trying to add a “pending” status to my status group that is only available for super admin users. I’ve added the pending status to my statuses list and I’m able to flag my entries as pending. But I need to display my pending status entries using the same templates when a super admin wants to preview them. I’ve tried using something like the following but it doesn’t seem to work:

    {exp:channel:entries channel="news" limit="5" status="{if group_id == '1'}open|pending{if:else}open{/if}" orderby="date" sort="desc"}
    ...
    {/exp:channel:entries}

    Is there anything else I can try to make this work? Any help is appreciated.

    Thank you,

    Mike

  • #2 / Jan 18, 2013 10:19am

    MadWebDesigns

    147 posts

    It looks like the only way to do it is like so:

    {if group_id == "1"}
    {exp:channel:entries channel="news" limit="5" status="open|pending" orderby="date" sort="desc"}
    ...display pending statuses for super admin
    {/exp:channel:entries}  
    {if:else}
    {exp:channel:entries channel="news" limit="5" status="open" orderby="date" sort="desc"}
    ...display only open status for all other non super admin members
    {/exp:channel:entries}  
    {/if}

    Mike

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

ExpressionEngine News!

#eecms, #events, #releases