Original link: https://zburu.com/posts/20220607
Typecho does not have the function of @
by default when commenting, you can add it with code.
In functions.php
:
/* * 评论回复时@ 评论人*/ function get_comment_at($coid) { $db = Typecho_Db::get(); $prow = $db->fetchRow($db->select('parent,status')->from('table.comments') ->where('coid = ?', $coid)); $mail = ""; $parent = @$prow['parent']; if ($parent != "0") { $arow = $db->fetchRow($db->select('author,status,mail')->from('table.comments') ->where('coid = ?', $parent)); @$author = @$arow['author']; $mail = @$arow['mail']; if(@$author && $arow['status'] == "approved"){ if (@$prow['status'] == "waiting"){ echo '<p class="commentReview">(评论审核中))</p>'; } echo '<a href="#comment-' . $parent . '">@' . $author . '</a>'; }else{ if (@$prow['status'] == "waiting"){ echo '<p class="commentReview">(评论审核中))</p>'; }else{ echo ''; } } } else { if (@$prow['status'] == "waiting"){ echo '<p class="commentReview">(评论审核中))</p>'; }else{ echo ''; } } }
Then add in comments.php
before the code to output the comment content:
<?php $parentMail = get_comment_at($comments->coid)?><?php echo $parentMail;?>
▼ Code shown
▼Renderings
This article is reproduced from: https://zburu.com/posts/20220607
This site is for inclusion only, and the copyright belongs to the original author.