Skip to content

Actually distribute the filtered post status#159

Merged
tlovett1 merged 15 commits intomasterfrom
fix/distribute-post-status
Jul 26, 2018
Merged

Actually distribute the filtered post status#159
tlovett1 merged 15 commits intomasterfrom
fix/distribute-post-status

Conversation

@barryceelen
Copy link
Contributor

@barryceelen barryceelen commented Jul 7, 2018

A filter was introduced in #157 which allows filtering the post statuses that are allowed to be distributed. That pull request however did not pass along the post status when distributing the post. This pull request:

  • Adds a hidden post status input containing the current post status.

  • Removes the previously added dt_drafts_can_be_distributed filter from the push ui.
    The functionality provided by the dt_drafts_can_be_distributed is now handled by the dt_distributable_post_statuses filter.

    • By default, only published posts can be distributed.
    • If the current post status is not distributable, the push ui is not added to the admin bar.
    • The post is distributed using the current post status (if that is allowed by the distributable_post_statuses filter).
    • The "As Draft" checkbox is only visible if the post is not a draft and 'draft' is a distributable post status.
    • If the "As Draft" checkbox is selected the post is distributed as a draft.

Syndicatable function fixes:

  • The syndicatable() function may be called outside of a post edit screen. The distributable_post_types and distributable_post_statuses check within it is moved to the proper context to prevent errors.
    (Fixes "Notice: Trying to get property of non-object in .../distributor/includes/push-ui.php on line 41").
  • The syndicatable() function returned true for all post types when the admin bar is shown on the front end.

Related: #112

Note: The 'prefix distributable post types' change accidentally slipped in, but was removed again. That update is tracked separately in #158.

@barryceelen barryceelen requested a review from tlovett1 July 12, 2018 13:41
@tlovett1 tlovett1 merged commit 4f92cae into master Jul 26, 2018
@barryceelen barryceelen deleted the fix/distribute-post-status branch July 30, 2018 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants