From 6f55010df211c8b5f41b123b3901ef600873d14f Mon Sep 17 00:00:00 2001 From: Django Doucet Date: Fri, 10 Mar 2023 15:23:08 -0700 Subject: [PATCH] fix preprocess_comment cap check --- includes/class-comments.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-comments.php b/includes/class-comments.php index 88ff47e..5d49d7e 100644 --- a/includes/class-comments.php +++ b/includes/class-comments.php @@ -32,10 +32,10 @@ class Comments { return $commentdata; } $user = \get_userdata( $commentdata['user_id'] ); - $comment_post_type = \get_post_type( $commentdata['comment_post_ID'] ); + $comment_parent_post = \get_post_type( $commentdata['comment_post_ID'] ); $post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ); - if ( $user->has_cap( 'publish_post' ) && \in_array( $comment_post_type, $post_types, true ) ) { + if ( $user->has_cap( 'publish_post', $commentdata['comment_post_ID'] ) && \in_array( $comment_parent_post, $post_types, true ) ) { $commentdata['comment_meta']['protocol'] = 'activitypub'; } return $commentdata;