Skip to content

Commit

Permalink
feat(10up#524): Add hooks for subscription post push
Browse files Browse the repository at this point in the history
This feature adds to hooks for dt_subscription_after_post_push and dt_subscriptions_after_post_push to be able to take action after a subscribed post has been pushed and after the entire set of subscriptions have been pushed
  • Loading branch information
aaronware committed Apr 6, 2023
1 parent 91fe0e4 commit 0744320
Showing 1 changed file with 26 additions and 0 deletions.
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 );
}


}

}

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 );
}

/**
Expand Down

0 comments on commit 0744320

Please sign in to comment.