Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 24 Nov 2008, 21:20
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
How do I automatically turn on/off specific forums at a set time?

I looked for some cron hacks that would do this but couldn't find any.

Here's what I want to do:

1. Automatically turn off certain forums on Saturday night.
2. Automatically turn them back on on Monday AM.

If I can't do it via the cron tab then could somebody give me an example of an SQL query that would turn off/on a forum so I could perform them all en masse at once if I have to do it manually?
__________________
Rich
LtCol, USMC
PuritanBoard
Reply With Quote
  #2  
Old 25 Nov 2008, 12:16
CypherSTL's Avatar
CypherSTL CypherSTL is offline
 
Join Date: Mar 2006
Real name: Patrick
If you use Linux, and have access to create local cron job to execute a script at said times.

With the forums offline, I dont think vBulletin Cron Jobs will still function, so you would have to look "external of vBulletin" I would imagine.
__________________
MySpace | Consultant | Web and Software Developer | Microsoft Certified Professional

"Wielding power untouched by mortal man."
Reply With Quote
  #3  
Old 25 Nov 2008, 12:48
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
Originally Posted by CypherSTL View Post
If you use Linux, and have access to create local cron job to execute a script at said times.

With the forums offline, I dont think vBulletin Cron Jobs will still function, so you would have to look "external of vBulletin" I would imagine.
Thanks for the reply.

All the forums would not be offline but just the few forums that I want to turn off. I have about 150 forums and would be turning off only about 8 of them during the period.

My problem is not knowing that a cron job could be set up in Linux or vBulletin but how.
__________________
Rich
LtCol, USMC
PuritanBoard
Reply With Quote
  #4  
Old 25 Nov 2008, 12:55
CypherSTL's Avatar
CypherSTL CypherSTL is offline
 
Join Date: Mar 2006
Real name: Patrick
Read over the vBulletin Manual for scheduled tasks here: http://www.vbulletin.com/docs/html/scheduled_tasks

Looks like all you have to do is write a PHP Script to modify your database to make changes to the forum sections in question.
__________________
MySpace | Consultant | Web and Software Developer | Microsoft Certified Professional

"Wielding power untouched by mortal man."
Reply With Quote
  #5  
Old 25 Nov 2008, 13:13
ReCom ReCom is offline
 
Join Date: Mar 2008
I spent about 30 minutes cracking this up:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Modify the SQL query $sql to put the forumids you are interested in. Then save as forumswitch.php in your vbulletin directory.

Set two Scheduled Tasks in AdminCP that call forumswitch.php?enable=0 and forumswitch.php?enable=1 respectively.
Reply With Quote
  #6  
Old 25 Nov 2008, 13:46
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
Thanks so much ReCom!

Just so I'm clear, it seems like this line is t[he one with the forumid:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Do I replace the 57 with my forum id?
I have about 10 forums to turn off, do I replace the '57' with something like '1,2,3,4,5,6,7,8,9,10'?
__________________
Rich
LtCol, USMC
PuritanBoard

Last edited by SemperFideles; 25 Nov 2008 at 13:51.
Reply With Quote
  #7  
Old 25 Nov 2008, 13:53
ReCom ReCom is offline
 
Join Date: Mar 2008
Originally Posted by SemperFideles View Post
Thanks so much ReCom!

Just so I'm clear, it seems like this line is t[he one with the forumid:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Do I replace the 57 with my forum id?
I have about 10 forums to turn off, do I replace the '57' with something like '1,2,3,4,5,6,7,8,9,10'?
Nope, you use IN, as in:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #8  
Old 25 Nov 2008, 15:53
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
I did a test run and get this error:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Rich
LtCol, USMC
PuritanBoard
Reply With Quote
  #9  
Old 25 Nov 2008, 16:05
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Did you save the script where suggested? Have you renamed your admincp? What path did you put for your Scheduled Task Filename?
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #10  
Old 25 Nov 2008, 16:20
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
Lynne,

Are you ReCom?

I saved it both in my vBulletin directory (same error) and in my includes/cron directory within my vBulletin directory (same error).

I have not renamed admincp.

--------------- Added 25 Nov 2008 at 16:23 ---------------

Here is the error when run from the vBulletin directory:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Rich
LtCol, USMC
PuritanBoard

Last edited by SemperFideles; 25 Nov 2008 at 16:23. Reason: Auto-Merged DoublePost
Reply With Quote
  #11  
Old 25 Nov 2008, 17:40
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
No, I am not ReCom. I just thought I would put out some comments to try to help because it looked like there was a path wrong somewhere along the lines. But, if you think the paths are all correct, then fine.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #12  
Old 26 Nov 2008, 00:04
ReCom ReCom is offline
 
Join Date: Mar 2008
Originally Posted by SemperFideles View Post
I did a test run and get this error:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Hmmm, seels like Scheduled Tasks don't accept filenames with query string attached ...

Two alternatives:
  1. Either forget about scheduled tasks and simply invoke the forumswitch.php manually at specified time
  2. Or wrap the forumswitch.php code into a function that takes the $enable value (true/false), and then create two separate files that include the forumswitch.php and call the function with either true or false respectively. Use these separate files in the scheduled tasks.
Reply With Quote
  #13  
Old 02 Dec 2008, 05:57
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
I ended up simplifying this:

forumswitchoff.php looks like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

forumswitchon.php looks like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Rich
LtCol, USMC
PuritanBoard
Reply With Quote
  #14  
Old 02 Dec 2008, 06:28
ReCom ReCom is offline
 
Join Date: Mar 2008
Cool. I didn't know we can do math in SQL queries
Reply With Quote
  #15  
Old 02 Dec 2008, 14:52
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Real name: Rich
The format you gave me was critical for the IN command as well as how to put a db query inside a PHP file. The format for the actual SQL query to turn a forum on or off was in the VBulletin 3.7 tricks forum at vbulletin.com. I really appreciate your help or I wouldn't have been able to do it.
__________________
Rich
LtCol, USMC
PuritanBoard
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 01:03.

Layout Options | Width: Wide Color: