# taskbuilder/6.0.2/includes/admin/settings/wppm_set_edit_priority.php

Taskbuilder – Project Management &amp; Task Management Tool With Kanban Board, version 6.0.2. 43 lines.

- Page: https://pluginprobe.com/plugins/taskbuilder/6.0.2/code/includes/admin/settings/wppm_set_edit_priority.php
- Raw: https://pluginprobe.com/plugins/taskbuilder/6.0.2/raw/includes/admin/settings/wppm_set_edit_priority.php
- Modified: 2026-08-22T18:03:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/taskbuilder/6.0.2/code/includes/admin/settings/wppm_set_edit_priority.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
  exit; // Exit if accessed directly
}

global $current_user, $wpdb;

if (!($current_user->ID && $current_user->has_cap('manage_options') || ($current_user->ID && $current_user->has_cap('wppm_admin')))) {
	exit;
} 
if ( check_ajax_referer( 'wppm_set_edit_priority', '_ajax_nonce', false ) != 1 ) {
  wp_send_json_error( 'Unauthorised request!', 401 );
}

$priority_id = isset($_POST) && isset($_POST['priority_id']) ? absint(sanitize_text_field(wp_unslash($_POST['priority_id']))) : 0;
if (!$priority_id) {exit;}
$priority_id = absint($priority_id);

$priority_name = isset($_POST) && isset($_POST['priority_name']) ? sanitize_text_field(wp_unslash($_POST['priority_name'])) : '';
if (!$priority_name) {exit;}

$priority_color = isset($_POST) && isset($_POST['priority_color']) ? sanitize_text_field(wp_unslash($_POST['priority_color'])) : '';
if (!$priority_color) {exit;}

$priority_bg_color = isset($_POST) && isset($_POST['priority_bg_color']) ? sanitize_text_field(wp_unslash($_POST['priority_bg_color'])) : '';
if (!$priority_bg_color) {exit;}

if ($priority_color==$priority_bg_color) {
  echo '{ "sucess_status":"0","messege":"'.esc_html__('Priority color and background color should not be same.','taskbuilder').'" }';
  die();
}
$values= array(
  'name'=>($priority_name),
  'color'=>($priority_color),
  'bg_color'=>($priority_bg_color)
);
$wpdb->update($wpdb->prefix.'wppm_task_priorities',$values,array('id'=>intval($priority_id))); 
echo wp_json_encode( array(
		'sucess_status' => 1,
		'messege'        => esc_html__( 'Success', 'taskbuilder' ),
) );
wp_die();
?>
```
