Open adamsilverstein opened 6 years ago
cc: @tlovett1
@adamsilverstein did #159 solve this?
Yes, I think this is resolved although I haven't gone back to test. I'll try to to that soon and close.
@adamsilverstein mind re-testing this to see if it can be closed?
@adamsilverstein mind re-testing this to see if it can be closed?
Pushing draft posts is disabled by default.
verified
Pushing drafts can be enabled by returning true from the dt_drafts_can_be_distributed filter. [Update] This was replaced by the distributable_post_statuses filter .
verified filter works as expected, added:
add_filter( 'dt_distributable_post_statuses', function() { return array( 'publish', 'draft' ); } );
and draft was distributable.
When a draft post is distributed, copies will always have a status of draft. The 'As Draft' option is not available when distributing drafts (showing it would be confusing).
verified this
When a published post is distributed, copies will have a status of draft if the 'As Draft' checkbox is left checked, or 'publish' if it is unchecked.
Verified.
Updating:
When an origin published post is updated (or a draft published), no change is made to the status of distributed copies.This behavior can be overwritten by returning true from the (not yet implemented) dt_published_posts_distribute_status filter.
verified no change in remote status. don't see dt_published_posts_distribute_status
_it might be possible to achieve this with the dt_push_post_args
filter._
If the dt_published_posts_distribute_status is set to true and an origin post status is changed from publish to any other status (a "takedown"), or any non published post is updated, the statuses of distributed copies are updated to match. Status could be trash, private, draft, autodraft, future, pending, etc.
not in place as far as I can tell.
Deleting
When an origin post is deleted, remote posts are unlinked and the editor shows a warning message: This post was distributed from [SITENAME]. However, the original has been deleted.
verified. post also becomes unlinked (editable)
The one thing missing is a dt_published_posts_distribute_status
filter to determine if a posts's status should be distributed.
I started work on addressing the final issue here in https://github.com/10up/distributor/pull/446
I found a simple workaround to automatically trash posts on the receiving site that were trashed on the pushing site. It's possible since the permalink does update to "__trashed" correctly, just the post status doesn't. With this added to the receiving site's functions.php it does:
$args = array(
'post_type' => array('post'), // post types you want to check
'posts_per_page' => -1
);
$posts = get_posts($args);
foreach($posts as $p){
$expiredlink = get_permalink( $p->ID );
if(strpos($expiredlink, "__trashed") !== false) {
$postdata = array(
'ID' => $p->ID,
'post_status' => 'trash'
);
wp_update_post($postdata);
}
}
Thanks for this @TangramWerbeagentur! We're working to document and think through the various implications this has, especially as this inter-relates to distributing "as draft", to ensure we're considering all use cases and not negatively impacting a current use case with a PR on this topic.
Updating post status
What happens when a post that has been distributed is published, or changed from published to draft (or moved to the trash)
Opening this issue to discuss the expected behavior when a post that has been distributed has it's post status changed.
Related: https://github.com/10up/distributor/issues/107 & https://github.com/10up/distributor/pull/110 & https://github.com/10up/distributor/pull/159
Expected behavior
After some internal discussion, we have decided that the expected behavior for post status changes is as follows:
Distributing:
dt_drafts_can_be_distributed
filter~. [Update] This was replaced by thedistributable_post_statuses
filter.Updating:
dt_published_posts_distribute_status
filter. [Update 2023-11-29] The default behavior is that this is disabled/false.dt_published_posts_distribute_status
is set to true and an origin post status is changed from publish to any other status (a "takedown"), or any non published post is updated ("embargo lifted"), the statuses of distributed copies are updated to match. Status could be trash, private, draft, autodraft, future, pending, etc.Deleting
This post was distributed from [SITENAME]. However, the original has been deleted.
[Update 2023-11-29] This could be altered using the samedt_published_posts_distribute_status
set to true to similarly delete the remote posts, but this should be disabled/false by default.Connections
Remaining Todo after testing
Add a
dt_published_posts_distribute_status
filter to determine if a posts's status should be distributed along with other post data.