此问题之前已经有人提过,不过还是老版本:
——————————————————————————————————————
https://discuz.dismall.com/thread-817995-1-1.html
提问:
我设置了A版发主题积分+2, B版发主题积分+1,如果我把A版的主题移到B版后,发现该主题作者的积分没有改变,并没有像我想象的那样减掉一分。
请问如果我希望在移动主题的同时自动根据版块的积分设置来调整作者的积分,需要如何实现?
通过修改代码,终于实现了移动主题后积分的自动加减
不敢独享,贴出修改的代码,管理员也帮我看看是否有问题:
1. 打开 inlucde/moderation.inc.php 文件
2. 找到 $modaction = 'MOV'; 这一行
3. 在该行的上面添加如下代码便可
————————————————————————————————————————
x3.2的文件在 source\include\topicadmin\topicadmin_moderate.php 570行
经测试,此代码在新版无法执行,请懂discuz代码的人一起调整
// ====== allyfeng修改 各版块积分不同,移动主题积分同步变更的问题 (Start) ======================
//移动主题后的用户积分更新
$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['first']) {
$tuidarray[] = $post['authorid'];
} else {
$ruidarray[] = $post['authorid'];
}
}
// 获得目标版块的积分值
$query = $db->query("SELECT postcredits,replycredits FROM {$tablepre}forumfields WHERE fid='$moveto'");
$moveto_forum = $db->fetch_array($query);
foreach(array('postcredits', 'replycredits') as $key) {
$moveto_forum[$key] = !empty($moveto_forum[$key]) ? unserialize($moveto_forum[$key]) : array();
}
$moveto_postcredits = $moveto_forum['postcredits'] ? $moveto_forum['postcredits'] : $creditspolicy['post'];
$moveto_replycredits = $moveto_forum['replycredits'] ? $moveto_forum['replycredits'] : $creditspolicy['reply'];
if($tuidarray) {
updatepostcredits('-', $tuidarray, $postcredits);
updatepostcredits('+', $tuidarray, $moveto_postcredits);
}
if($ruidarray) {
updatepostcredits('-', $ruidarray, $replycredits);
updatepostcredits('+', $ruidarray, $moveto_replycredits);
}
// ====== allyfeng修改 (End) ============================
|