vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   help in automating a task (https://vborg.vbsupport.ru/showthread.php?t=174765)

Keyser520 04-01-2008 05:57 AM

help in automating a task
 
I want to automate a task to run once a day. This task should look at the last time a thread was posted in a section. If no thread was posted in the last 30 days, that forum needs to be turned off and closed. How can I implement this?

Thanks in advance,
Keyser520

Dismounted 04-01-2008 08:05 AM

You can create a vBulletin Scheduled Task to do what you want.

Keyser520 04-01-2008 11:22 AM

That's what I'm asking: how do I do that? I don't see the options in the scheduled task to do any of the things I asked in the first post. Can you give me specifics of how to do this? Or point me to a place where examples are posted?

Dismounted 04-01-2008 01:19 PM

You will need to create your own task using PHP. I don't believe there are any examples relevant to this task.

Keyser520 04-01-2008 01:50 PM

Could you help me at all? I know php, but I don't know the way vbulletin is programmed, so creating such a task is knowledge that I don't have.

Lynne 04-01-2008 02:25 PM

I've written a couple of cron jobs/Scheduled Tasks for my site. Here is the basic template I use:

Code:

<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
    exit;
}

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

Queries and Stuff Here
$vbulletin->db->query("Your Query"
);


log_cron_action('', $nextitem, 1);

?>


Keyser520 04-01-2008 03:02 PM

To be more specific:

I have sections on my forum for instructors/djs. Each of them is the moderator of their own specific forum. I want to have the script check to see if that user has posted in their forum in the last month. If they have not, i want it to close and hide that forum.

Dismounted 04-02-2008 05:24 AM

This requires more knowledge of MySQL than PHP. All the PHP you need has been posted by Lynne. You just need to craft an SQL query to delete the posts/threads/forums. You need to compare dateline (in the database) to the current time. dateline is UNIX time (seconds from epoch).

Keyser520 04-02-2008 10:18 PM

That's the part I don't have knowledge of... :-(

Jase2 04-02-2008 10:22 PM

Well, you can always request to someone make the mod (unpaid). Or, you can post in the "Request for paid services" forum and see if someone will create it you.


All times are GMT. The time now is 04:22 PM.

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.01024 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete