// Handle add perspective form if ( $perspectives_table_exists && isset($_POST['add_perspective']) && !empty($_POST['perspective_name']) && !empty($_POST['perspective_type']) ) { $name = sanitize_text_field($_POST['perspective_name']); $type = sanitize_text_field($_POST['perspective_type']); $states = isset($_POST['perspective_states']) ? sanitize_text_field($_POST['perspective_states']) : null; $is_default = !empty($_POST['perspective_default']) ? 1 : 0; $target_project_id = $is_default ? null : $project_id; // Only allow user to add non-fixed perspectives if ($type === 'fixed') { echo '
Cannot add new fixed perspectives.
Failed to add perspective: ' . esc_html($wpdb->last_error) . '
Perspective added.