本帖最后由 otherbank 于 2012-7-20 18:16 编辑
修改后台用户组的设置,由“会员每小时发帖数限制“到”会员每天发帖数限制“,下面分别讲一下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,修改检验程序文件,友“会员每小时发帖数限制“修改为”会员每天发帖数限制“
"\source\class\table\table_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));
- }
复制代码 注:感谢 64243354 对本教程的协助!!! |