[TIP/TRICK] Time Limit Board

Started by [SiNaN], August 23, 2008, 12:00:36 PM

Previous topic - Next topic

[SiNaN]

Question: How can I restrict the access of a certain membergroup outside a set time frame?
Original Topic: http://www.simplemachines.org/community/index.php?topic=254008.0

../Sources/Load.php

Find:

?>

Replace:

function check_board_time()
{
global $board, $modSettings, $user_info;

if(allowedTo('moderate_forum') || empty($board) || !in_array('ID_GROUP', $user_info['groups']));
return true;

$time =  (int) date("H");

if($context['user']['is_logged'])
$time = $time + (int) $user_info['time_offset'];
else
$time = $time + (int) $modSettings['time_offset'];

if($time > 23)
$time = $time - 24;

if($time > 8 && $time < 17 & $board == 'BOARD_ID')
fatal_error('You can\'t see this board at this time.');
}

?>


../index.php

Find:

loadPermissions();

Replace:

loadPermissions();

// What time is it?
check_board_time();


Change 'BOARD_ID' as the ID of the board to be restricted.
Change 'ID_GROUP' as the ID of the group to be restricted.
Edit $time > 8 && $time < 17 statement to change the restricted hours.
Former SMF Core Developer | My Mods | SimplePortal

BuЯЯЯЯaK


Advertisement: