Add New Task Status

NOTE: This feature is available starting from version 1.6.2

By default, SudoWorkspace ships with 5 predefined statuses: Not Started, In Progress, Testing, Awaiting Feedback, and Complete, but you can inject new statuses with a simple action hook to fit your needs.

We assume that you have some basic knowledge of reading php code for this article, but it won’t be that hard if you don’t have it. You can just copy and paste the code and adjust the keys for your needs (see below key explanation).

In this example, you will add 2 new task statuses with names On Hold and Ready For Production

In application/helpers a create file my_functions_helper.php and add the following code:

application/helpers
my_functions_helper.php
<?php

// Version 2.3.0 and above hooks()->add_filter('before_get_task_statuses','my_add_custom_task_status');

// Prior to version 2.3.0 // Uncomment the code below and remove the code above if you are using version older then 2.3.0 // add_action('before_get_task_statuses','my_add_custom_task_status');

function my_add_custom_task_status($current_statuses){ // Push new status to the current statuses $current_statuses[] = array( 'id'=>50, // new status with id 50 'color'=>'#989898', 'name'=>'On Hold', 'order'=>10, 'filter_default'=>true, // true or false

); // Push another status (delete this code if you need to add only 1 status) $current_statuses[] = array( 'id'=>51, //new status with new id 51 'color'=>'#be51e0', 'name'=>'Ready For Production', 'order'=>11, 'filter_default'=>true // true or false );

// Return the statuses return $current_statuses; }

<?php

// Version 2.3.0 and above hooks()->add_filter('before_get_task_statuses','my_add_custom_task_status');

// Prior to version 2.3.0 // Uncomment the code below and remove the code above if you are using version older then 2.3.0 // add_action('before_get_task_statuses','my_add_custom_task_status');

function my_add_custom_task_status($current_statuses){ // Push new status to the current statuses $current_statuses[] = array( 'id'=>50, // new status with id 50 'color'=>'#989898', 'name'=>'On Hold', 'order'=>10, 'filter_default'=>true, // true or false

); // Push another status (delete this code if you need to add only 1 status) $current_statuses[] = array( 'id'=>51, //new status with new id 51 'color'=>'#be51e0', 'name'=>'Ready For Production', 'order'=>11, 'filter_default'=>true // true or false );

// Return the statuses return $current_statuses; }

<?php

// Version 2.3.0 and above hooks()->add_filter('before_get_task_statuses','my_add_custom_task_status');

// Prior to version 2.3.0 // Uncomment the code below and remove the code above if you are using version older then 2.3.0 // add_action('before_get_task_statuses','my_add_custom_task_status');

function my_add_custom_task_status($current_statuses){ // Push new status to the current statuses $current_statuses[] = array( 'id'=>50, // new status with id 50 'color'=>'#989898', 'name'=>'On Hold', 'order'=>10, 'filter_default'=>true, // true or false

); // Push another status (delete this code if you need to add only 1 status) $current_statuses[] = array( 'id'=>51, //new status with new id 51 'color'=>'#be51e0', 'name'=>'Ready For Production', 'order'=>11, 'filter_default'=>true // true or false );

// Return the statuses return $current_statuses; }

After you adjust the code to fit your needs, save the file my_functions_helper.php , and you will be able to see your new task statuses.
my_functions_helper.php