修改後台用戶組的設置,由「會員每小時發帖數限制「到」會員每天發帖數限制「,下面分別講一下Discuz! X2和Discuz! X2.5的修改方法。
一、Discuz! X2的修改方法:
1,修改後台設置顯示;
"sourcelanguagelang_admincp.php"的5021行
- 'project_option_group_maxpostsperhour' => '會員每小時發帖數限制',
複製代碼
修改為:
- 'project_option_group_maxpostsperhour' => '會員每天發帖數限制',
複製代碼
2,修改發帖數超過限制提醒文字;
sourcelanguagelang_message.php"的105行
- 'post_flood_ctrl_posts_per_hour' => '抱歉,您所在的用戶組每小時限制發帖 {posts_per_hour} 個,請稍候再發表',
複製代碼
修改為:
- 'post_flood_ctrl_posts_per_hour' => '抱歉,您所在的用戶組每天限制發帖 {posts_per_hour} 個,請稍候再發表',
複製代碼
3,修改檢驗程序文件,友「會員每小時發帖數限制「修改為」會員每天發帖數限制「
"sourcefunctionfunction_post.php"的313行
- function checkmaxpostsperhour() {
- global $_G;
- $morepostsperhour = false;
- if(!$_G['group']['disablepostctrl'] && $_G['uid']) {
- if($_G['group']['maxpostsperhour']) {
- $timestamp = $_G['timestamp']-3600;
- $userposts = DB::result_first('SELECT COUNT(*) FROM '.DB::table('common_member_action_log')." WHERE dateline>$timestamp AND (`action`='".getuseraction('tid')."' OR `action`='".getuseraction('pid')."') AND uid='$_G[uid]'");
- $isflood = $userposts && ($userposts >= $_G['group']['maxpostsperhour']);
- if($isflood) {
- $morepostsperhour = true;
- }
- }
- }
- return $morepostsperhour;
- }
複製代碼
修改為:
- function checkmaxpostsperhour() {
- global $_G;
- $morepostsperhour = false;
- if(!$_G['group']['disablepostctrl'] && $_G['uid']) {
- if($_G['group']['maxpostsperhour']) {
- $timestamp = $_G['timestamp']-86400;
- $userposts = DB::result_first('SELECT COUNT(*) FROM '.DB::table('common_member_action_log')." WHERE dateline>$timestamp AND (`action`='".getuseraction('tid')."' OR `action`='".getuseraction('pid')."') AND uid='$_G[uid]'");
- $isflood = $userposts && ($userposts >= $_G['group']['maxpostsperhour']);
- if($isflood) {
- $morepostsperhour = true;
- }
- }
- }
- return $morepostsperhour;
- }
複製代碼
二、Discuz! X2.5的修改方法:
1,修改後台設置顯示;
"sourcelanguagelang_admincp.php"的3703行
- 'usergroups_edit_basic_hour_threads' => '會員每小時發主題數限制',
- 'usergroups_edit_basic_hour_threads_comment' => '設置允許會員每小時最多的發主題數量,可以配合灌水預防功能進一步限制會員的發帖,可設置為 1~255 範圍內的數值,0 為不限制。此功能會輕微加重服務器負擔,且對遊客無效',
- 'usergroups_edit_basic_hour_posts' => '會員每小時發回帖數限制',
- 'usergroups_edit_basic_hour_posts_comment' => '設置允許會員每小時最多的發回帖數量,可以配合灌水預防功能進一步限制會員的發帖,可設置為 1~255 範圍內的數值,0 為不限制。此功能會輕微加重服務器負擔,且對遊客無效',
複製代碼
修改為:
- 'usergroups_edit_basic_hour_threads' => '會員每天發主題數限制',
- 'usergroups_edit_basic_hour_threads_comment' => '設置允許會員每天最多的發主題數量,可以配合灌水預防功能進一步限制會員的發帖,可設置為 1~255 範圍內的數值,0 為不限制。此功能會輕微加重服務器負擔,且對遊客無效',
- 'usergroups_edit_basic_hour_posts' => '會員每天發回帖數限制',
- 'usergroups_edit_basic_hour_posts_comment' => '設置允許會員每天最多的發回帖數量,可以配合灌水預防功能進一步限制會員的發帖,可設置為 1~255 範圍內的數值,0 為不限制。此功能會輕微加重服務器負擔,且對遊客無效',
複製代碼
sourcelanguagelang_message.php"的144行
- 'thread_flood_ctrl_threads_per_hour' => '抱歉,您所在的用戶組每天限制發主題 {threads_per_hour} 個,請稍候再發表',
複製代碼
修改為:
- 'thread_flood_ctrl_threads_per_hour' => '抱歉,您所在的用戶組每天限制發主題 {threads_per_hour} 個,請稍候再發表',
複製代碼
3,修改檢驗程序文件,友「會員每小時發帖數限制「修改為」會員每天發帖數限制「
"sourceclasstabletable_common_member_action_log.php"的32行
- public function count_per_hour($uid, $type) {
- return DB::result_first('SELECT COUNT(*) FROM %t WHERE dateline>%d AND `action`=%d AND uid=%d', array($this->_table, TIMESTAMP - 3600, getuseraction($type), $uid));
- }
複製代碼
修改為:
- public function count_per_hour($uid, $type) {
- return DB::result_first('SELECT COUNT(*) FROM %t WHERE dateline>%d AND `action`=%d AND uid=%d', array($this->_table, TIMESTAMP - 86400, getuseraction($type), $uid));
- }
複製代碼
參考以上方法,我們可以修改discuz x3系列相關VIP每天發帖數限制 |