Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Using custom statuses with Publisher

Status Resolved
Add-on / Version Publisher
Severity Trivial
EE Version

Benjamin Smith

Feb 26, 2013

I want to use a custom status, “featured”, for channel entries along with the publisher workflow (http://boldminded.com/add-ons/publisher/drafts-workflow).

Based on the docs, I am seeing that the value of the status field should not have any impact on the current state of the entry (draft vs. published), am I correct?

What I am seeing now is that if I save a draft, with a status of “featured”, it will show in my channel:entries loops. Is there some setting or parameter that I am missing to make sure that draft content is never shown on the front-end, regardless of status?

#1

BoldMinded (Brian)

Just some background info: there are 2 types of statuses in Publisher. Publisher’s Published/Draft status, and EE’s native Status drop down field, which should have no bearing on showing Publisher data. The native Status drop down is still used, so you can save an entry as a Publisher draft with a Featured status, and if the entries tag has a status=”Featured” param, then it will load the entry regardless of the Publisher status.

I’m unable to replicate what you are saying. When a new entry is created as a Publisher Draft is assigned the native status field value of Draft too. Even if I create a new entry and set its native status field to Featured Publisher still sets the native status field to Draft, thus its hidden on the site. If I edit the same entry, save it as a Publisher Draft and change the native status field to Featured it sticks as Publisher Draft and native Featured.

#2

Benjamin Smith

1) “The native Status drop down is still used, so you can save an entry as a Publisher draft with a Featured status, and if the entries tag has a status=“Featured” param, then it will load the entry regardless of the Publisher status.”

This is the issue - I want to have a “featured” post, but not have it show up on the front-end of the site unless it has been published - is this possible? is there any way to check for draft vs. published status from a channel entries loop? I think it is safe to say that users would never want draft content to appear on the front-end, regardless of the native EE status field setting.

2) “When a new entry is created as a Publisher Draft is assigned the native status field value of Draft too.”

Also, if the native EE status field is completely independent of the Publisher status field, then why have the “Draft” status added to the native field dropdown?

Sorry if I am misunderstanding what you are saying, thank you.

#3

BoldMinded (Brian)

The statuses are independent, but it still needs to create a Draft status in the native status field so the entry does not show in the site until its published. I should rephrase it and say they’re not completely independent… they do work in unison, but they are not tightly coupled. For example Better Workflow, from my experience, does not work very well with custom statuses… it hi-jacks the native status field in what I consider a non-friendly manor. Publisher doesn’t hi-jack it, so its more friendly, but it does need to change the value to Draft to keep a brand new entry from showing on the site before its ready.

This code will let you set the new entry as Featured, save it as a Publisher Draft, and the status will remain as Featured (prior to this patch it forces the native status field back to Draft). If an entries tag has status=”Featured” in it, then the Publisher Draft will be displayed on the front-end, potentially before its ready, which it sounds like is the opposite of what you’re looking for, in which case the behavior current behavior is what you probably want. You’ll set the native status field to Featured, or just leave it alone, save it as a Publisher Draft, thus it will not appear on the front-end. When its ready to go live, then you change the native status field to Featured and Publisher status to Published.

In models/publisher_entry.php around line 256 you’ll see this:

// Now set this entry's status to our new draft
                    $this->EE->db->where('entry_id', $this->data_columns['entry_id'])
                             ->update('channel_titles', array('status' => lang(PUBLISHER_STATUS_DRAFT)));

Change it to this:

if (in_array($meta['status'], array(PUBLISHER_STATUS_DRAFT, PUBLISHER_STATUS_OPEN)))
                {
                    // Now set this entry's status to our new draft
                    $this->EE->db->where('entry_id', $this->data_columns['entry_id'])
                             ->update('channel_titles', array('status' => lang(PUBLISHER_STATUS_DRAFT)));
                }
#4

Benjamin Smith

Thanks for the explanation and code snippet. The only issue in my workflow with:

“When its ready to go live, then you change the native status field to Featured and Publisher status to Published.”

is that I am scheduling these posts (using entry_date) to show up at a specific date/time, meaning the admin is not logged into the CMS at the time the post will go live.

I will likely just create a custom field to keep track of these featured posts, thus getting around any potential issues. Thank you so much for your support and creating this great module!

Login to reply