当前位置:网站首页>typecho 评论回复艾特评论人
typecho 评论回复艾特评论人
2022-06-09 15:14:00 【子舒】
typecho 在评论时默认是没有 @ 评论人的功能,可以用代码加一下。
在 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 '';
}
}
}然后在 comments.php 中输出评论内容代码的前面加上:
<?php $parentMail = get_comment_at($comments->coid)?><?php echo $parentMail;?>▼代码所示
▼效果图
边栏推荐
- Some tool functions commonly used in JS projects
- 道友,你都用Redis做啥了?
- ^27定时器的相关问题
- 实现图片灯箱功能
- [Typecho blog Xiaobai building tutorial] you are only one step away from having your own blog
- PHP cloud purchase source code with tutorial (source code)
- pixi.js 平铺背景
- Implementing MySQL master-slave with docker compose
- 軟件測試職業發展方向,6年老測試帶你走出迷茫...
- Revenue of Jinshan cloud Q1 is 2.17 billion yuan, including 1.38 billion yuan of public cloud and 790million yuan of industrial cloud
猜你喜欢
随机推荐
数组去重
Using kubekey to build kubernetes/kubesphere environment“
PHP cloud purchase source code with tutorial (source code)
[II. Virtual host and domain name resolution]
Applet turntable lottery assembly
JS event flow, event bubbling, prevent bubbling, event capture (you can understand it at a glance)
EasyExcel-合并单元格
陕西西安等保测评单位有哪些?在哪里可以查到?
Triangular constant strain element (CST) derived from area coordinates
III. servername matching rules
技术干货 | Linkis实践:新引擎实现流程解析
tmux(Terminal MultipleXer)命令使用
From outsourcing to self research and then to large factories, who knows how I came here in the past five years
List used by icomponent of unity dots
期货网上开户安全吗?期货妙手机开户吗?
After five years of testing in a large factory, he was ruthlessly dismissed in May. He wanted to remind his brother of fishing
[cloud native | kubernetes] in depth understanding of pod (VI)
淘宝小程序签到功能
国货彩妆,败走618
道友,你都用Redis做啥了?
![[VI. load balancing and related configurations]](/img/90/a9a16db438323e2d227db024d5f1e9.png)

![[v. reverse proxy and related configurations]](/img/b3/e0a3dc41c2d164adcd78bd81cef05c.png)




