| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
global $current_user, $wpdb; |
| 6 |
|
| 7 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;} |
| 8 |
|
| 9 |
$status_id = isset($_POST) && isset($_POST['status_id']) ? intval(sanitize_text_field($_POST['status_id'])) : ''; |
| 10 |
if (!$status_id) {exit;} |
| 11 |
|
| 12 |
$status_name = isset($_POST) && isset($_POST['status_name']) ? sanitize_text_field($_POST['status_name']) : ''; |
| 13 |
if (!$status_name) {exit;} |
| 14 |
|
| 15 |
$status_color = isset($_POST) && isset($_POST['status_color']) ? sanitize_text_field($_POST['status_color']) : ''; |
| 16 |
if (!$status_color) {exit;} |
| 17 |
|
| 18 |
$status_bg_color = isset($_POST) && isset($_POST['status_bg_color']) ? sanitize_text_field($_POST['status_bg_color']) : ''; |
| 19 |
if (!$status_bg_color) {exit;} |
| 20 |
|
| 21 |
if ($status_color==$status_bg_color) { |
| 22 |
echo '{ "sucess_status":"0","messege":"'.__('Status color and background color should not be same.','taskbuilder').'" }'; |
| 23 |
die(); |
| 24 |
} |
| 25 |
$values= array( |
| 26 |
'name'=>$status_name, |
| 27 |
'color'=>$status_color, |
| 28 |
'bg_color'=>$status_bg_color |
| 29 |
); |
| 30 |
$wpdb->update($wpdb->prefix.'wppm_task_statuses',$values,array('id'=>intval($status_id))); |
| 31 |
echo '{ "sucess_status":"1","messege":"Success" }'; |
| 32 |
?> |
| 33 |
|