Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

各版块积分不同,移贴未调整积分的问题(附代码,希望有人协助纠正)

[复制链接]
laijt 发表于 2014-7-16 12:20:35 | 显示全部楼层 |阅读模式


此问题之前已经有人提过,不过还是老版本:
——————————————————————————————————————
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) ============================

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-5 03:55 , Processed in 0.082728 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表