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.

Using status as a conditional

February 12, 2012 10:12pm

Subscribe [1]
  • #1 / Feb 12, 2012 10:12pm

    LW4 Comm

    16 posts

    This question may be related to a resolved thread.

    Has this been changed? I’ve tried it using a custom status “Draft” but it doesn’t work. If I change “Draft” to “open” it works. I’m using the correct cap.

    {exp:channel:entries channel="ministry_psp" url_title="{segment_3}" limit="1" status="open|Pending Admin Review|Draft" orderby="date" disable="pagination|trackbacks|member_data"}
    
     {if status == "Draft"}
      {notify-webmaster}
      {redirect="administration/psp/{segment_4}"}
     {/if}
    {/exp:channel:entries}
  • #2 / Feb 13, 2012 7:07pm

    Sean C. Smith

    3818 posts

    Hi LW4 Comm,

    I’m sorry that you are experiencing this problem. I just tested the following code and it worked for me.

    {exp:channel:entries limit="1" channel="test" status="Open|Draft"}
    
      <h3><a href="http://{comment_url_title_auto_path}">{title}</a></h3>
    
    <p>  {if status=="Draft"}<br />
        draft status<br />
      {/if}<br />
    {/exp:channel:entries}

    Are you sure that the entry you are looking at has a Draft Status? If you place something outside of the conditional content and the entry has a draft status does it appear on the front end?

    Sean

  • #3 / Feb 13, 2012 8:59pm

    LW4 Comm

    16 posts

    Ok, I’m really confused now because I just noticed that this is working for me in another section:

    {exp:channel:entries channel="ministry_psp" category="{segment_3_category_id}" status="Open|LC Approved|Pending LC Review|Pending Admin Review|Return To Director|Draft" dynamic="no" orderby="date" sort="desc" limit="10" paginate="bottom" disable="trackbacks|member_data"}
          <tr class="{switch='odd|even'}">
           <td><a href="http://{path=psp/psp-form/{url_title}/{segment_3}}">{entry_date format='%m/%d/%Y'}</a></td><td>{edit_date format="%m/%d/%Y"}</td><td>{author}</td><td>{psp_due_date format="%F %Y"}</td>  
           <td>
            {if status == "Draft"}
             <span>{status}</span>
            {if:elseif status == "Pending Admin Review"}
             <span>{status}</span>
            {if:elseif status == "Pending LC Review"}
             <span>{status}</span>
            {if:elseif status == "LC Approved"}
             <span>{status}</span>
            {if:elseif status == "Return To Director"}
             <span>{status}</span>
            {if:else}
             {status}
            {/if}
            
            {if notes}   <span>i>Notes!</i></span>{/if}
           </td>
          </tr>

    I guess I need to dig a little deeper into my code.

  • #4 / Feb 13, 2012 10:39pm

    LW4 Comm

    16 posts

    I feel like an idiot. It was working the whole time. It was what I was trying to make it do that didn’t work. I was trying to make it run php from a snippet. That was my problem. Thank you for your help.

  • #5 / Feb 14, 2012 10:17pm

    Robin Sowell

    13255 posts

    😉  Glad Sean got you fixed up.  If you run into anything else?  Just let us know!

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

ExpressionEngine News!

#eecms, #events, #releases