discuz 6.0 添加 版主已回複

來源:互聯網
上載者:User

資料庫方面:

 

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]&amp;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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.