Fatal Hazard
06-20-2013, 10:00 PM
Be able to ban users for a certain number of hours
[LEFT]
Template Edit Description:
This is an edit of the /modcp/banning.php file.
It allows you to ban users for a certain number of hours (you choose).
Difficulty: Easy
Step 1:
Open modcp/banning.php in an editor of your choice, for this tutorial I will be using Notepad ++.
On line 261 find the code:
// check that the number of days is valid if ($vbulletin->GPC['period'] != 'PERMANENT' AND !preg_match('#^(D|M|Y)_[1-9][0-9]?$#', $vbulletin->GPC['period'])) { print_stop_message('invalid_ban_period_specified') ; }Look at the (D|M|Y) code and do this:
// check that the number of days is valid if ($vbulletin->GPC['period'] != 'PERMANENT' AND !preg_match('#^(h|D|M|Y)_[1-9][0-9]?$#', $vbulletin->GPC['period'])) { print_stop_message('invalid_ban_period_specified') ; }As you can see, I have added the h before it. DON't use a capital H as it will not work.
Step 2:
On line 395 find this code:
// make a list of banning period options $periodoptions = array( $temporary_phrase => array( 'D_1' => "1 $vbphrase[day]", 'D_2' => "2 $vbphrase[days]", 'D_3' => "3 $vbphrase[days]", 'D_4' => "4 $vbphrase[days]", 'D_5' => "5 $vbphrase[days]", 'D_6' => "6 $vbphrase[days]", 'D_7' => "7 $vbphrase[days]", 'D_10' => "10 $vbphrase[days]", 'D_14' => "2 $vbphrase[weeks]", 'D_21' => "3 $vbphrase[weeks]", 'M_1' => "1 $vbphrase[month]", 'M_2' => "2 $vbphrase[months]", 'M_3' => "3 $vbphrase[months]", 'M_4' => "4 $vbphrase[months]", 'M_5' => "5 $vbphrase[months]", 'M_6' => "6 $vbphrase[months]", 'Y_1' => "1 $vbphrase[year]", 'Y_2' => "2 $vbphrase[years]", ),Above the 'D_1' => "1 $vbphrase[day]", add:
'h_1' => "1 $vbphrase[hour]",</span>
'h_6' => "6 $vbphrase[hours]",</span>
'h_12' => "12 $vbphrase[hours]",</span>
You can change these to suit you best (or add more).
[LEFT]
Template Edit Description:
This is an edit of the /modcp/banning.php file.
It allows you to ban users for a certain number of hours (you choose).
Difficulty: Easy
Step 1:
Open modcp/banning.php in an editor of your choice, for this tutorial I will be using Notepad ++.
On line 261 find the code:
// check that the number of days is valid if ($vbulletin->GPC['period'] != 'PERMANENT' AND !preg_match('#^(D|M|Y)_[1-9][0-9]?$#', $vbulletin->GPC['period'])) { print_stop_message('invalid_ban_period_specified') ; }Look at the (D|M|Y) code and do this:
// check that the number of days is valid if ($vbulletin->GPC['period'] != 'PERMANENT' AND !preg_match('#^(h|D|M|Y)_[1-9][0-9]?$#', $vbulletin->GPC['period'])) { print_stop_message('invalid_ban_period_specified') ; }As you can see, I have added the h before it. DON't use a capital H as it will not work.
Step 2:
On line 395 find this code:
// make a list of banning period options $periodoptions = array( $temporary_phrase => array( 'D_1' => "1 $vbphrase[day]", 'D_2' => "2 $vbphrase[days]", 'D_3' => "3 $vbphrase[days]", 'D_4' => "4 $vbphrase[days]", 'D_5' => "5 $vbphrase[days]", 'D_6' => "6 $vbphrase[days]", 'D_7' => "7 $vbphrase[days]", 'D_10' => "10 $vbphrase[days]", 'D_14' => "2 $vbphrase[weeks]", 'D_21' => "3 $vbphrase[weeks]", 'M_1' => "1 $vbphrase[month]", 'M_2' => "2 $vbphrase[months]", 'M_3' => "3 $vbphrase[months]", 'M_4' => "4 $vbphrase[months]", 'M_5' => "5 $vbphrase[months]", 'M_6' => "6 $vbphrase[months]", 'Y_1' => "1 $vbphrase[year]", 'Y_2' => "2 $vbphrase[years]", ),Above the 'D_1' => "1 $vbphrase[day]", add:
'h_1' => "1 $vbphrase[hour]",</span>
'h_6' => "6 $vbphrase[hours]",</span>
'h_12' => "12 $vbphrase[hours]",</span>
You can change these to suit you best (or add more).