Skip to content

Commit

Permalink
✨ 优化关于评论仅作者可见内容处理
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Feb 3, 2023
1 parent 7324e46 commit bf68906
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inc/fun/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ function pk_comment_author_view($text, $comment)
{
global $authordata;
$author_view = get_post_meta($comment->comment_post_ID, 'author_cat_comment', true) == 'true';
if(empty($authordata)){
if (empty($authordata)) {
$authordata = get_userdata(get_post_field('post_author', $comment->comment_post_ID));
}
$is_author = $authordata->ID == get_current_user_id();
if($author_view && !$is_author){
$text = apply_filters('pk_comment_author_view','<div class="fs12 c-sub"><i class="fa fa-lock"></i> 评论仅对作者可见</div>');
$is_author = apply_filters('pk_comment_author_view_is_author', $authordata->ID, $authordata->ID == get_current_user_id());
if ($author_view && !$is_author) {
$text = apply_filters('pk_comment_author_view', '<div class="fs12 c-sub"><i class="fa fa-lock"></i> 评论仅对作者可见</div>');
}
return $text;
}
Expand Down

0 comments on commit bf68906

Please sign in to comment.