fix preprocess_comment cap check

This commit is contained in:
Django Doucet 2023-03-10 15:23:08 -07:00
parent 1fe5959960
commit 6f55010df2

View file

@ -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;