typecho comment reply ate commenter

Original link: https://zburu.com/2022/06/07/132.html

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
1654569311759.png

▼Renderings
1654569512094.png


My blog will be synchronized to Tencent Cloud + Community, and I invite everyone to join: https://cloud.tencent.com/developer/support-plan?invite_code=17ctk6evsjk5b

This article is reproduced from: https://zburu.com/2022/06/07/132.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.