修改后台用户组的设置,由 「会员每小时发帖数限制 「到」 会员每天发帖数限制 「,下面分别讲一下 Discuz! X2 和 Discuz! X2.5 的修改方法。
一、 Discuz! X2 的修改方法:
1,修改后台设置显示;
"source/language/lang_admincp.php"的 5021 行
- 'project_option_group_maxpostsperhour' => '会员每小时发帖数限制',
修改为:
- 'project_option_group_maxpostsperhour' => '会员每天发帖数限制',
2,修改发帖数超过限制提醒文字;
source/language/lang_message.php"的 105 行
- 'post_flood_ctrl_posts_per_hour' => '抱歉,您所在的用户组每小时限制发帖 {posts_per_hour} 个,请稍候再发表',
修改为:
- 'post_flood_ctrl_posts_per_hour' => '抱歉,您所在的用户组每天限制发帖 {posts_per_hour} 个,请稍候再发表',
3,修改检验程序文件,友 「会员每小时发帖数限制 「修改为」 会员每天发帖数限制 「
"source/function/function_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,修改后台设置显示;
"source/language/lang_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 为不限制。此功能会轻微加重服务器负担,且对游客无效',
source/language/lang_message.php"的 144 行
- 'thread_flood_ctrl_threads_per_hour' => '抱歉,您所在的用户组每天限制发主题 {threads_per_hour} 个,请稍候再发表',
修改为:
- 'thread_flood_ctrl_threads_per_hour' => '抱歉,您所在的用户组每天限制发主题 {threads_per_hour} 个,请稍候再发表',
3,修改检验程序文件,友 「会员每小时发帖数限制 「修改为」 会员每天发帖数限制 「
"sourceclass able able_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));
- }