ID, 'wppm_capability', true ); if (($current_user->has_cap('manage_options')) || $wppm_current_user_capability == 'wppm_manager'|| $wppm_current_user_capability == 'wppm_admin') { // project name $name = isset($_POST['name']) ? sanitize_text_field(wp_unslash($_POST['name'])) : ''; if($name) $args['name'] = $name; // Description $project_description = ''; if ( !empty( $_POST['wppm_proj_description'] ) ) { $project_description = wp_kses_post( wp_unslash( $_POST['wppm_proj_description'] ) ); } if($project_description) $args['wppm_proj_description'] = $project_description; //Project start date $text = isset($_POST['wppm_start_date']) ? sanitize_text_field(wp_unslash($_POST['wppm_start_date'])) : ''; if($text) $args['wppm_start_date'] = wp_date("Y-m-d H:i:s" ,strtotime($text)); //Project end date $text2 = isset($_POST['wppm_end_date']) ? sanitize_text_field(wp_unslash($_POST['wppm_end_date'])) : ''; if($text2) $args['wppm_end_date'] = wp_date("Y-m-d H:i:s" ,strtotime($text2)); // Category $project_category = isset($_POST['wppm_create_project_category']) ? intval(sanitize_text_field(wp_unslash($_POST['wppm_create_project_category']))) : ''; if($project_category) $args['wppm_create_project_category'] = $project_category; //Assign user $users = array(); if ( isset( $_POST['user_names'] ) && is_array( $_POST['user_names'] ) ) { $users = array_map( 'absint', wp_unslash( $_POST['user_names'] ) ); $users = array_unique( $users ); } if($users) $args['user_names'] = $wppmfunction->sanitize_array($users); //public project $public_proj = isset($_POST['wppm_public_project']) ? 1 : 0; $args = apply_filters( 'wppm_before_create_project_args', $args); $project_id = WPPM_Functions::create_project($args); if ( empty( $project_id ) ) { wp_send_json_error( 'Permission denied', 403 ); } $auth_code = $wppmfunction->getRandomString(10); $wppmfunction->add_project_meta($project_id,'public_project',$public_proj); $wppmfunction->add_project_meta($project_id,'project_auth_code',$auth_code); } do_action('wppm_after_project_created',$project_id);