Advertisement:

Author Topic: Access Restictions Based on Time of Day  (Read 3323 times)

Offline Majicc

  • Newbie
  • *
  • Posts: 1
Access Restictions Based on Time of Day
« on: August 06, 2008, 03:38:20 PM »
I am looking for a way to restrict the access of a certain membergroup outside a set time frame.

I have a set of users who do not need to be accessing the board outside 8am-5pm. Draconian I know but problematic if i cant figure it out.

Does anyone know how I would accomplish this?

I am using the latest version (1.1.5) with the base configuration, nothing added to it.

Many thanks for your assistance.

Offline Nathaniel

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,117
  • Gender: Male
    • Verbtest.com
Re: Access Restictions Based on Time of Day
« Reply #1 on: August 19, 2008, 03:15:33 AM »
Time restrictions sounds like an interesting idea, I can't particularly think of a need for it, but I will have a look into it.

Its the sort of thing that you could ask for as a mod request. ;)
http://www.simplemachines.org/community/index.php?board=79.0
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,524
  • Young and Foolish
    • SimplePortal
Re: Access Restictions Based on Time of Day
« Reply #2 on: August 20, 2008, 01:41:11 PM »
Sounds good.

../Sources/Load.php

Find:

Code: [Select]
?>
Replace:

Code: [Select]
function check_board_time()
{
global $board, $modSettings;

if(allowedTo('moderate_forum') || empty($board));
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.
Former SMF Core Developer | My Mods | SimplePortal