viewthread.php- $post['groupid'] = getgroupid($post['authorid'], $_DCACHE['usergroups'][$post['groupid']], $post);
复制代码 to- $post['groupid'] = getgroupid($post['authorid'], $_DCACHE['usergroups'][$post['groupid']], $post, 1);
复制代码 include/global.func.php- function getgroupid($uid, $group, &$member) {
- global $creditsformula, $db, $tablepre;
- if(!empty($creditsformula)) {
- $updatearray = array();
- eval("\$credits = round($creditsformula);");
- if($credits != $member['credits']) {
- $updatearray[] = "credits='$credits'";
- }
- if($group['type'] == 'member' && !($member['credits'] >= $group['creditshigher'] && $member['credits'] < $group['creditslower'])) {
- $query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND $member[credits]>=creditshigher AND $member[credits]<creditslower LIMIT 1");
- if($db->num_rows($query)) {
- $member['groupid'] = $db->result($query, 0);
- $updatearray[] = "groupid='$member[groupid]'";
- }
- }
- if($updatearray) {
- $db->query("UPDATE {$tablepre}members SET ".implode(', ', $updatearray)." WHERE uid='$uid'");
- }
- }
- return $member['groupid'];
- }
复制代码 to- function getgroupid($uid, $group, &$member, $unadmin=0) {
- global $creditsformula, $db, $tablepre;
- if(!empty($creditsformula)) {
- $updatearray = array();
- eval("\$credits = round($creditsformula);");
- if($credits != $member['credits']) {
- $updatearray[] = "credits='$credits'";
- }
- $allow= $unadmin && $member['adminid'] >= 0 ? true : $group['type'] == 'member';
- if($allow && !($member['credits'] >= $group['creditshigher'] && $member['credits'] < $group['creditslower'])) {
- $query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND $member[credits]>=creditshigher AND $member[credits]<creditslower LIMIT 1");
- if($db->num_rows($query)) {
- $member['groupid'] = $db->result($query, 0);
- $updatearray[] = "groupid='$member[groupid]'";
- }
- }
- if($updatearray && !($unadmin && $group['type'] != 'member')) {
- $db->query("UPDATE {$tablepre}members SET ".implode(', ', $updatearray)." WHERE uid='$uid'");
- }
- }
- return $member['groupid'];
- }
复制代码 修改前一定要备份 我目前测试没问题 但不保证绝对不出意外
[ 本帖最后由 习明 于 2008-7-21 13:42 编辑 ] |