Jump to content
DevFuse Forums
Due to a family and medical emergency, support has been delayed and will be delayed for the next few weeks. I'm sorry for those who have been waiting and will try my hardest to reply to everyone as soon as possible.
Sign in to follow this  

[IPB 2.3.x] Adding your own task

There is many reasons while you might need a task in your modification, from clearing out your mods logs to performing resource intensives tasks in the background, like updating categories views.

IP.Board allows you to add a task without editing any files. To start off we need to add a file to the sources/tasks/ folder. You can name this file what ever you want, in this example we are going to call it news.php.


if ( ! defined( 'IN_IPB' ) )
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";

class task_item
var $class = "";
var $root_path = "";
var $task = "";

function run_task()
// Run what ever we need in a task here, this is just like any other file and should be able to
// run what ever you had in components_public and want to run as a task.

// Add to task log?
$this->class->append_task_log( $this->task, 'Task news.php has run.' );

// Unlock Task
// leave this one alone, you need to unlock a task.
$this->class->unlock_task( $this->task );

function register_class(&$class)
$this->class = &$class;
$this->ipsclass =& $class->ipsclass;
$this->root_path = $this->class->root_path;

function pass_task( $this_task )
$this->task = $this_task;

It's best to leave all the functions alone and just add your task code above $this->class->append_task_log( $this->task, 'Task news.php has run.' );

Next you will need to setup the task details in the admin cp. Go to Admin CP > Tools & Settings Tab > Task Manager > Add New Task button. I've added a screenshot of the example details we need to fill out. Remember to name the [b]Task PHP File To Run[/b] field the same name as your sources/tasks/ file with .php added to the end of it.


Recommended Comments

There are no comments to display.

  • Create New...