|
经测试还比较可靠。但是需要版主审核。 原理是:比如用户组"限制会员","新手上路" ,用户一注册完肯定是"限制会员",这时后台设置下发帖需要审核,然后版主或者管理员在前台或者后台对他的帖子进行审核,审核通过加积分,加了积分会员就会 升级到"新手上路",这时就不需要审核了。不过由于版本里面有些问题,发完审核帖会默认加积分的,这时需要修改一下代码。 未通过审核帖不加积分lib/forum/topicpost.class.php 找到 - $this->post->updateUserInfo($this->type, $this->userCreidtSet(), $this->data['content']);
改成 - //by zhaojun
- //$this->post->updateUserInfo($this->type, $this->userCreidtSet(), $this->data['content']);
- $credit_set = $this->creditSet();
- if($this->data['ifcheck']=='0'){
- foreach($credit_set as $key=>$value){
- $credit_set[$key] = 0;
- }
- $this->post->updateUserInfo($this->type, $credit_set, $this->data['content'], $this->data['ifcheck']);
- }else{
- $this->post->updateUserInfo($this->type, $credit_set, $this->data['content'], $this->data['ifcheck']);
- $this->afterpost();
- }
- //by zhaojun
lib/forum/replypost.class.php 找到 - if ($this->data['ifcheck'] == 1) $this->post->updateUserInfo($this->type, $this->userCreidtSet(), $this->data['content']);
改成 - //by zhaojun
- //$this->post->updateUserInfo($this->type, $this->userCreidtSet(), $this->data['content']);
- $credit_set = $this->creditSet();
- if($this->data['ifcheck']=='0'){
- foreach($credit_set as $key=>$value){
- $credit_set[$key] = 0;
- }
- $this->post->updateUserInfo($this->type, $credit_set, $this->data['content'], $this->data['ifcheck']);
- }else{
- $this->post->updateUserInfo($this->type, $credit_set, $this->data['content'], $this->data['ifcheck']);
- // $this->afterpost();
- }
- //by zhaojun
lib/forum/post.class.php 找到 - function updateUserInfo($type, $add, $content = '') {
改成 - function updateUserInfo($type, $add, $content = '',$ifcheck) {
找到 - $this->user['todaypost'] ++;
- $this->user['monthpost'] ++;
- $this->user['postnum'] ++;
- $this->user['lastpost'] = $timestamp;
改成 - if($ifcheck!='0'){
- $this->user['todaypost'] ++;
- $this->user['monthpost'] ++;
- $this->user['postnum'] ++;
- $this->user['lastpost'] = $timestamp;
- }
lib/forum/delarticle.class.php - $delCredit && $credit->runsql();
删除 admin/tpccheck.php(后台通过审核积分操作) 找到(有两处) 第一个 - foreach ($fids as $key => $value) {
上上上加 - //xiaohu 2010/11/29 add credit
- require_once (R_P . 'require/credit.php');
- global $db_creditset,$credit;
- //end
- //add by xiaohu 审核通过后添加积分和发帖数
- $query = $db->query("SELECT tid,fid,tpcstatus,authorid,author FROM pw_threads WHERE $sql AND tid IN(".pwImplode($pass).")");//xiaohu add credit 2010/11/29
- while ($rt = $db->fetch_array($query)) {
- $tablename = GetTtable($rt['tid']);
- $arrtmsgs[$tablename][] = $rt['tid'];
- $fids[$rt['fid']] ++;
- if ($rt['tpcstatus'] && getstatus($rt['tpcstatus'], 1)) {
- $cydb[] = $rt['tid'];
- }
- //xiaohu 2010/11/29 add credit
- $forumcredit = unserialize($db->get_value("select creditset from pw_forumsextra where fid=".pwEscape($rt['fid'])));
- $creditset = $credit->creditset($forumcredit, $db_creditset);
- $creditset = $creditset['Post'];
- $credit->sets($rt['authorid'], $creditset, false);
- $credit->runsql();
- $db->query("update pw_memberdata set postnum=postnum+1 where uid=".pwEscape($rt['authorid']));
- //end
- }
第2个上加 - //xiaohu 2010/11/29 add credit
- require_once (R_P . 'require/credit.php');
- global $db_creditset,$credit;
- //end
- //add by xiaohu 审核通过后添加积分和发帖数
- $query = $db->query("SELECT pid,tid,fid,authorid,author FROM pw_posts WHERE $sql AND pid IN(".S::sqlImplode($pass).")");//xiaohu add credit 2010/11/29
- while ($rt = $db->fetch_array($query)) {
- $tablename = GetTtable($rt['tid']);
- $arrtmsgs[$tablename][] = $rt['tid'];
- //$fids[$rt['fid']] ++;
- //xiaohu 2010/11/29 add credit
- $forumcredit = unserialize($db->get_value("select creditset from pw_forumsextra where fid=".pwEscape($rt['fid'])));
- $creditset = $credit->creditset($forumcredit, $db_creditset);
- $creditset = $creditset['Post'];
- $credit->sets($rt['authorid'], $creditset, false);
- $credit->runsql();
- $db->query("update pw_memberdata set postnum=postnum+1 where uid=".pwEscape($rt['authorid']));
- //end
- }
找到 - $readdb = $delarticle->getTopicDb("$sql AND tid $sqlby");
下下下加 - //xiaohu 2010/11/29 删除主题先添加一个postnum 然后后面又减少了一个
- $userService = L::loadClass('UserService', 'user');
- foreach($readdb as $read){
- $userService->updateByIncrement($read['authorid'], array(), array('postnum'=>+1));
- }//end
|