数据库方面:
threads 表新建 adminreply 字段,在数据库里执行下句 SQL 即可。
alter table `cdb_threads` add column `adminreply` tinyint (1) DEFAULT '0' NOT NULL after `supe_pushstatus`
[newreply.inc.php]
文件存放路径:/include/newreply.inc.php
大约 353 行的位置,在“ updatepostcredits('+', $discuz_uid, $replycredits); ”那行代码之前,“ } else { ”代码之后,
下面贴出代码,比对修改。
$forum['threadcaches'] && deletethreadcaches($tid);
if($modnewreplies) {
$db->query("UPDATE {$tablepre}forums SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED');
if($newsubscribed) {
$db->query("UPDATE {$tablepre}threads SET subscribed='1' WHERE tid='$tid'", 'UNBUFFERED');
}
if(!$allowuseblog || empty($isblog)) {
showmessage('post_reply_mod_succeed', "forumdisplay.php?fid=$fid");
} else {
showmessage('post_reply_mod_blog_succeed', "blog.php?tid=$tid&starttime=$starttime&endtime=$endtime&page=$page");
}
} else {
$query = $db->query("SELECT groupid FROM cdb_members WHERE username='$author' LIMIT 1");
$groupid=0;
while($row = $db->fetch_array($query)) {
if(1 == $row['groupid']||2 == $row['groupid']||3 == $row['groupid']){
$groupid=3;
}
}
if(3 == $groupid){
$adminreply = "adminreply=adminreply+1,";
$db->query("UPDATE {$tablepre}threads SET $adminreply lastposter='$author', lastpost='$timestamp', replies=replies+1 ".($attachment ? ', attachment=/'1/'' : '').", subscribed='".($subscribed || $newsubscribed ? 1 : 0)."' WHERE tid='$tid'", 'UNBUFFERED');
}
else{
$db->query("UPDATE {$tablepre}threads SET lastposter='$author', lastpost='$timestamp', replies=replies+1 ".($attachment ? ', attachment=/'1/'' : '').", subscribed='".($subscribed || $newsubscribed ? 1 : 0)."' WHERE tid='$tid'", 'UNBUFFERED');
}
updatepostcredits('+', $discuz_uid, $replycredits);
[forumdisplay.htm]
文件存放路径:/templates/default/forumdisplay.htm
大约 247 行,在“ <!--{if $thread['attachment'] == 2}--> ”那行代码之前,“ <!--{/if}--> ”代码之后,插入
<span id="thread_$thread[tid]"><a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]>$thread[subject]</a></span>
<!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->
<!--{if $thread['price'] > 0}-->
<!--{if $thread['special'] == '3'}-->
- [{lang thread_reward}
<!--{else}-->
- [{lang price}
<!--{/if}-->
{$extcredits[$creditstrans][title]} <span class="bold">$thread[price]</span> {$extcredits[$creditstrans][unit]}]
<!--{elseif $thread['special'] == '3' && $thread['price'] < 0}-->
- [{lang reward_solved}]
<!--{/if}-->
<!--{if $thread['adminreply'] > 0}-->
<img src="images/other/hf.gif" style="vertical-align:middle;margin:0 8px;" />
<!--{/if}-->
<!--{if $thread['attachment']}-->
<img src="images/attachicons/common.gif" alt="{lang attachment}" class="attach" />
<!--{/if}-->
[topicadmin.php]
文件存放路径:/
删除的时候也要注意一下,可能客服把自己回复的帖子删了呢,所以回复次数的数据也要同时更新。
在“ $action == 'delpost' ”的逻辑里,大约 154 行的位置,在“ if($thread['special']) { ”代码之前,“ $db->query("DELETE FROM {$tablepre}posts WHERE pid IN ($pids)"); ” 代码之后,插入
$db->query("DELETE FROM {$tablepre}ratelog WHERE pid IN ($pids)");
$db->query("DELETE FROM {$tablepre}myposts WHERE pid IN ($pids)");
$db->query("DELETE FROM {$tablepre}attachments WHERE pid IN ($pids)");
$db->query("DELETE FROM {$tablepre}posts WHERE pid IN ($pids)");
$adminreply = 0;
$query = $db->query("SELECT groupid FROM {$tablepre}members WHERE uid IN (SELECT authorid FROM {$tablepre}posts WHERE tid='$tid')");
while($row = $db->fetch_array($query)) {
if(1 == $row['groupid']||2 == $row['groupid']||3 == $row['groupid']){
$adminreply--;
}
}
$db->query("UPDATE {$tablepre}threads SET adminreply=adminreply+'$adminreply' WHERE tid='$tid'");
if($thread['special']) {
$db->query("DELETE FROM {$tablepre}trades WHERE pid IN ($pids)");
}
摘抄自:http://www.discuz.net/forum.php?mod=viewthread&tid=1550122