vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Need script to close forum by cron job (https://vborg.vbsupport.ru/showthread.php?t=259160)

BadGuy 02-20-2011 12:36 PM

Need script to close forum by cron job
 
Hi

Looking for someone to make a small script to close forum by cron job

Check this thread : ( check post #4 )
https://vborg.vbsupport.ru/showthread.php?t=207069

Best Regards

kh99 02-20-2011 02:00 PM

The forum open/close is controlled by $vbulletin->options['bbactive'], so I started looking at how you might set that using a script. But since it's saved in the datastore it gets pretty complicated. But then I realized you could just override it in a plugin using the init_startup hook. Setting $vbulletin->options['bbactive'] to false will close the forum, so you could add whatever other check you wanted, like

Code:

if (check something outside vbulletin)
{
    $vbulletin->options['bbactive'] = false;
}

and maybe check the contents of a file or something. (Of course whatever you do gets done on every page access, so hopefully it's fast).

Someone else recently asked about having banners appear/disappear based on the time of day (https://vborg.vbsupport.ru/showthrea...31#post2163631), so another option might be to use that and make the forum automatically close between certain hours. I guess in that case you'd want it to just use the server time so it would match up with the cron job, so it could be something like:

Code:

$thishour = date("G");
if ($thishour >= 1 && $thishour < 3)
{
    $vbulletin->options['bbactive'] = false;
}

(to have the forum down between 1 and 3 AM, for example. ETA: The condition was wrong originally, had to make it ">=" for the starting hour).

Anyway, I know it's not exactly what you asked for, but maybe some of it will be useful.


All times are GMT. The time now is 06:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01100 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete