← All changes
|
includes/admin/tasks/open_task/wppm_set_clone_task.php
+23
-11
6.0.4
→
6.0.6
View file →
| @@ -1,15 +1,28 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | -global $wpdb,$current_user,$wppmfunction; | |
| 6 | -if ( !empty( sanitize_text_field(wp_unslash($_POST['_ajax_nonce'])) ) ) { | |
| 7 | - $nonce = sanitize_text_field( wp_unslash( $_POST['_ajax_nonce'] ) ); | |
| 8 | - if ( ! wp_verify_nonce( $nonce, 'wppm_set_clone_task' ) ) { | |
| 9 | - wp_send_json_error( array( | |
| 10 | - 'message' => esc_html__( 'Security check failed.', 'taskbuilder' ) | |
| 11 | - ) ); | |
| 5 | +global $wpdb, $current_user, $wppmfunction; | |
| 6 | +$is_internal_clone = ! empty( $internal_code_flag ); | |
| 7 | +if ( ! $is_internal_clone ) { | |
| 8 | + if ( | |
| 9 | + empty( $_POST['_ajax_nonce'] ) || | |
| 10 | + ! wp_verify_nonce( | |
| 11 | + sanitize_text_field( | |
| 12 | + wp_unslash( $_POST['_ajax_nonce'] ) | |
| 13 | + ), | |
| 14 | + 'wppm_set_clone_task' | |
| 15 | + ) | |
| 16 | + ) { | |
| 17 | + wp_send_json_error( | |
| 18 | + array( | |
| 19 | + 'message' => esc_html__( | |
| 20 | + 'Security check failed.', | |
| 21 | + 'taskbuilder' | |
| 22 | + ) | |
| 23 | + ) | |
| 24 | + ); | |
| 12 | 25 | } |
| 13 | 26 | } |
| 14 | 27 | $prev_task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : $ptask_id ; |
| 15 | 28 | $task = $wppmfunction->get_task($prev_task_id); |
| @@ -42,9 +55,10 @@ | ||
| 42 | 55 | 'wppm_create_task_priority'=>$task['priority'], |
| 43 | 56 | 'user_names'=>explode(",",$task['users']), |
| 44 | 57 | 'date_created'=>$task['date_created'], |
| 45 | 58 | 'task_auth_code'=> $wppmfunction->getRandomString(10), |
| 46 | - 'active'=>1 | |
| 59 | + 'active'=>1, | |
| 60 | + 'parent_task_id'=>isset($task['parent_task_id']) ? $task['parent_task_id'] : 0 | |
| 47 | 61 | ); |
| 48 | 62 | $task_id = $wppmfunction->create_task($values); |
| 49 | 63 | if(!isset($project_id) || $wppm_default_duplicate_project_email_notification==1){ |
| 50 | 64 | do_action('wppm_after_task_created', $task_id); |
| @@ -127,7 +141,5 @@ | ||
| 127 | 141 | } |
| 128 | 142 | } |
| 129 | 143 | } |
| 130 | 144 | do_action("wppm_after_task_clone",$prev_task_id,$task_id); |
| 131 | -wp_send_json_success(array( | |
| 132 | - 'task_id' => $task_id | |
| 133 | -)); | |
| 145 | +return $task_id; | |