12, 'headers' => array( 'X-OrderGuard-Key' => orderguard_get_api_key() ), ) ); if ( ! is_wp_error( $reply ) && 200 === (int) wp_remote_retrieve_response_code( $reply ) ) { $data = json_decode( wp_remote_retrieve_body( $reply ), true ); $url = is_array( $data ) && array_keys( $data ) === array( 'pass' ) ? orderguard_support_url( $data['pass'] ) : ''; if ( $url ) { // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- fixed support host/path; only a format-checked bearer pass is appended. wp_redirect( $url, 303 ); exit; } } // 0.3.1: an unavailable support service is not a server error. Return to the Support tab with a notice instead of // wp_die(), which answers HTTP 500 (and some hosts replace any 500 page with their own error page). set_transient( 'orderguard_flag_notice_' . get_current_user_id(), 'support_err', 120 ); wp_safe_redirect( admin_url( 'admin.php?page=orderguard&tab=support' ) ); exit; } add_action( 'admin_post_orderguard_support', 'orderguard_handle_support' ); function orderguard_render_support() { if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } $me = orderguard_get_me( true ); $is_pro = is_array( $me ) && ( $me['plan'] ?? '' ) === 'pro'; // 0.3.1 UI: header (team, languages) + two channels (forum, priority) + covered / not covered. ?>