save_status_form

Triggered upon saving data when the task status is being changed, including the Kanban section.

Teamwork

Input (passed by reference)

$params['task'] array Task properties as an array with the following keys:
$params['task']['id'] int Task ID.
$params['task']['name'] string Task name.
$params['task']['create_contact_id'] int ID of the user who has added the task.
$params['task']['create_datetime'] datetime Task creation date and time.
$params['task']['update_datetime'] datetime Date and time of the most recent task update.
$params['task']['assigned_contact_id'] int|null Assigned user ID.
$params['task']['project_id'] int ID of the project to which the task belongs.
$params['task']['milestone_id'] int|null ID of the milestone to which the task belongs.
$params['task']['number'] int Task number within its project.
$params['task']['status_id'] int Task status ID.
$params['task']['priority'] int Priority value.
$params['task']['assign_log_id'] int ID of the latest task assignment log entry.
$params['task']['hidden_timestamp'] int|null Timestamp of the date and time until which the task was marked as hidden.
$params['task']['due_date'] date Deadline date.
$params['task']['comment_log_id'] date ID of the latest task comment adding log entry.
$params['task']['uuid'] string Global task identifier.
$params['task']['public_hash'] string|null Hash string used in the task’s public link URL.
$params['data'] array Task status change data array with the following keys:
$params['data']['status_id'] int New task status ID.
$params['data']['prev_status_id'] int Previous task status ID.
$params['status'] array New task status data as an array with the following keys:
$params['status']['id'] int Status ID.
$params['status']['name'] string Status name.
$params['status']['icon'] string Status icon class name.
$params['status']['params'] array Status parameters selected in its settings.
… your plugin code …

Output

Teamwork

Plugin code example

PHP

public function saveStatusForm($params)
{
    waLog::log(
        sprintf_wp(
            'The status of task #%d has changed to “%s”.',
            $params['task']['id'],
            $params['status']['name']
        ),
        sprintf('tasks/plugins/%s/save_status_form.log', $this->id)
    );
}