通过修改代码,终于实现了移动主题后积分的自动加减
不敢独享,贴出修改的代码,管理员也帮我看看是否有问题:
1. 打开 inlucde/moderation.inc.php 文件
2. 找到 $modaction = 'MOV'; 这一行
3. 在该行的上面添加如下代码便可- // ====== 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) ============================
复制代码 |