Skip to content
Open
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
14 changes: 13 additions & 1 deletion lib/subscriber/webhooks.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ public function processPost( $request, $event ) {
update_post_meta( $inserted_post, 'muut_likes', '0' );
update_post_meta( $inserted_post, 'muut_thread_likes', '0' );
}

// Hook to perform action after Post
do_action('muut_webhook_after_request_post', $request, $event, $inserted_post);
}

/**
Expand All @@ -435,7 +438,9 @@ public function processReply( $request, $event ) {
if ( $inserted_comment ) {
update_comment_meta( $inserted_comment, 'muut_likes', '0' );
}


// Hook to perform action after Reply
do_action('muut_webhook_after_request_reply', $request, $event, $inserted_comment);
}

/**
Expand Down Expand Up @@ -521,13 +526,20 @@ public function processRemove( $request, $event ) {
// Remove the number of likes from the thread count of likes.
$post_likes = $post_likes - $likes;
update_post_meta( $comment->comment_post_ID, 'muut_thread_likes', $post_likes );

// Hook before the comment is deleted
do_action('muut_webhook_after_request_remove', $request, $event, 'comment', $comment->comment_ID);

wp_delete_comment( $comment->comment_ID, true );
}
// The path leads the a top-level thread.
} else {
$thread_post = self::webhookGetPostFromPath( $path, 'any' );

if ( $thread_post ) {
// Hook before the post is deleted
do_action('muut_webhook_after_request_remove', $request, $event, 'post', $thread_post->ID);

wp_delete_post( $thread_post->ID, true );
}
}
Expand Down