New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix status list, calendar, and story budget to show custom post statuses and show post states in post list. #446
Conversation
Fixes #445 Previously, the `get_post_status_friendly_name` function was retreiving the WordPress built-in Post Statuses and the Custom Statuses set within the plugin interface. If you happen to register a post status another way, it would not appear in the Status Column of your Post Type. This fix simplifies the logic to just get all the post stati, built-in, registered through the plugin interface, and registered on their own. It returns the label that was set for each status.
Stop using `get_post_status_friendly_name`
Get custom post statuses in the Calendar view and in the ICS file
Instead of changing this function entirely, let’s just stop using it. This commit puts it back to what it used to be so that Email Notifications can still use it.
Get the post status label directly instead of using a helper function
Function is no longer needed
Get all statuses for posts, filter all statuses, and make sure “Unpublished” accounts for custom statuses.
Get and filter all statuses for Story Budget. Update the “Unpublished” status to account for these custom statuses.
In some instances, there will be a Post that has a Post State that is not it’s post status. Example: Gutenberg, Liveblog. We are filtering all post states with `check_if_post_state_is_status` and if a post’s post state does not match it’s post status, we will show it as a post state next to the title of the post. The Post Status will remain in the Status column.
Need to check if it’s a new post and return if it is.
@mikeyarce thanks for the quick fix! this seems to work fine. |
|
||
|
||
if ( $old_status == 'new' ) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of returning here if the old status is 'new' we should still allow a notification to be sent. We have already created a subject to handle this situation in line 514.
If we were to supply an $old_status_friendly_name
for this particular case instead of returning, it would prevent the call to get_post_status_object
in line 557 failing and causing an error for new posts.
This prevents duplicate conditional statements and sets a value for $old_status_friendly_name so that New or Auto-Draft that had no previous value will have something valid.
@anigeluk @mikeyarce LGTM after the change, merging |
Fixes #445
Previously, the
get_post_status_friendly_name
function was retrieving the WordPress built-in Post Statuses and the Custom Statuses set within the plugin interface. If you happen to register a post status another way, it would not appear in the Status Column of your Post Type.This PR removes the need for
get_post_status_friendly_name
in the Post List, Calendar, and Story Budget sections and instead just calls the post status label directly.This also adds a check to see if a Post State does not match the Post Status, and if it does not match, it will show the Post State. Example: