Discuz!4把所有删除帖子自动移动到某个论坛[回收站]
打开topicadmin.php,找到
if($operation == ‘delete’) {
…..
}
这段,把里面的代码全部用/**/注释了
替换为
$moveto_silence = 73; //要移动到的板块ID
$query = $db->query(”SELECT fid, name FROM {$tablepre}forums WHERE fid=’$moveto_silence’ AND status=’1′ AND type<>’group’”);
if(!$toforum = $db->fetch_array($query)) {
showmessage(’admin_move_invalid’);
}
$stickmodify = 0;
foreach($threads as $thread) {
if(in_array($thread[’displayorder’], array(2, 3))) {
$stickmodify = 1;
}
}
$displayorderadd = $adminid == 3 ? ‘, displayorder=\’0\'’ : ‘’;
$db->query(”UPDATE {$tablepre}threads SET fid=’$moveto_silence’, moderated=’1′ $displayorderadd WHERE tid IN ($moderatetids)”);
$db->query(”UPDATE {$tablepre}posts SET fid=’$moveto_silence’ WHERE tid IN ($moderatetids)”);
if($type == ‘redirect’) {
foreach($threads as $thread) {
$db->query(”INSERT INTO {$tablepre}threads (fid, readperm, iconid, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, poll, attachment)
VALUES (’$thread[fid]’, ‘$thread[readperm]’, ‘$thread[iconid]’, ‘”.addslashes($thread[’author’]).”‘, ‘$thread[authorid]’, ‘”.addslashes($thread[’subject’]).”‘, ‘$thread[dateline]’, ‘$thread[lastpost]’, ‘$thread[lastposter]’, ‘0′, ‘0′, ‘0′, ‘0′, ‘$thread[tid]’, ‘0′, ‘0′)”);
}
}
if($globalstick && $stickmodify) {
require_once DISCUZ_ROOT.’./include/cache.func.php’;
updatecache(’globalstick’);
}
$losslessdel = $losslessdel > 0 ? $timestamp - $losslessdel * 86400 : 0;
//Update members’ credits and post counter
$uidarray = $tuidarray = $ruidarray = array();
$query = $db->query(”SELECT first, authorid, dateline FROM {$tablepre}posts WHERE tid IN ($moderatetids)”);
while($post = $db->fetch_array($query)) {
if($post[’dateline’] < $losslessdel) {
$uidarray[] = $post[’authorid’];
} else {
if($post[’first’]) {
$tuidarray[] = $post[’authorid’];
} else {
$ruidarray[] = $post[’authorid’];
}
}
}
if($uidarray) {
updatepostcredits(’-', $uidarray, array());
}
if($tuidarray) {
updatepostcredits(’-', $tuidarray, $postcredits);
}
if($ruidarray) {
updatepostcredits(’-', $ruidarray, $replycredits);
}
$modaction = ‘DEL’;
updateforumcount($moveto_silence);
updateforumcount($fid);