Skip to content
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

feat(#524): Add hooks for subscription(s) post push #1043

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions includes/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,39 @@ function send_notifications( $post ) {
$update_subscriptions = true;

wp_delete_post( $subscription_id, true );

/**
* Fires after Distributor pushes a post subscription
*
* @since TBD
* @hook dt_after_set_meta
*
* @param {int} $post_id Post ID
* @param {int} $subscription_id Subscription ID
* @param {array} $request Request array
*/
do_action( 'dt_subscription_after_post_push', $post_id, $subscription_id, $request );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the status is currently failure at this point, should we consider tweaking the filter name to reflect this?

}


}

}

if ( $update_subscriptions ) {
update_post_meta( $post_id, 'dt_subscriptions', $subscriptions );
}

/**
* Fires after Distributor completes all subscriptions regardless of success/failure
*
* @since TBD
* @hook dt_after_set_meta
*
* @param {int} $post_id Post ID
* @param {array} $subscriptions Array of Subscriptions
*/
do_action( 'dt_subscriptions_after_post_push', $post_id, $subscriptions );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include $update_subscriptions as a third parameter so users can be informed of the success or failure status?

}

/**
Expand Down