Advertisement:

Author Topic: [TIP/TRICK] Time Limit Board  (Read 14757 times)

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,524
  • Young and Foolish
    • SimplePortal
[TIP/TRICK] Time Limit Board
« on: August 23, 2008, 12:00:36 PM »
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:

Code: [Select]
?>
Replace:

Code: [Select]
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:

Code: [Select]
loadPermissions();
Replace:

Code: [Select]
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

Offline BuЯЯЯЯaK

  • SMF Hero
  • ******
  • Posts: 2,121
  • Gender: Male
  • Burak
    • dinle sevgili
Re: [TIP/TRICK] Time Limit Board
« Reply #1 on: August 23, 2008, 12:07:18 PM »
Nice tip =)