function rbr_minnit_rest_api_submit(WP_REST_Request $request) { $nonce = $request->get_header('X-WP-Nonce'); if (!wp_verify_nonce($nonce, 'wp_rest')) { return new WP_Error('forbidden', __('Invalid security token. Please refresh the page.', 'rbr-minnit'), ['status' => 403]); } $name = sanitize_text_field($request->get_param('name')); $location = sanitize_text_field($request->get_param('location')); $message = sanitize_textarea_field($request->get_param('message')); if (empty($name) || empty($location) || empty($message)) { return new WP_Error('missing_fields', __('All fields are required.', 'rbr-minnit'), ['status' => 400]); } $name = mb_substr($name, 0, 30); $location = mb_substr($location, 0, 30); $message = mb_substr($message, 0, 128); $result = rbr_minnit_send_message($name, $location, $message); // --- TEMPORARY DEBUGGING CODE --- if (is_wp_error($result)) { $error_msg = $result->get_error_message(); $error_data = $result->get_error_data(); $debug_text = "API Error: " . $error_msg; if (isset($error_data['response'])) { $debug_text .= " | Minnit Says: " . wp_strip_all_tags($error_data['response']); } return new WP_Error('send_failed', $debug_text, ['status' => 500]); } // -------------------------------- return new WP_REST_Response([ 'success' => true, 'message' => __('Your request has been sent to the studio!', 'rbr-minnit') ], 200); } https://redberryradio.com/page-sitemap.xml 2026-09-29T18:33:29+00:00 https://redberryradio.com/product-sitemap.xml 2026-09-15T09:07:52+00:00 https://redberryradio.com/show-sitemap.xml 2026-05-22T16:27:40+00:00 https://redberryradio.com/rs-host-sitemap.xml 2026-05-22T15:29:18+00:00 https://redberryradio.com/rbr_kb-sitemap.xml 2026-09-27T05:21:08+00:00 https://redberryradio.com/rbrtm_team_member-sitemap.xml 2026-09-29T15:34:56+00:00 https://redberryradio.com/team_group-sitemap.xml 2026-09-29T15:34:56+00:00 https://redberryradio.com/product_brand-sitemap.xml 2026-09-15T09:07:52+00:00 https://redberryradio.com/product_cat-sitemap.xml 2026-09-15T09:07:52+00:00 https://redberryradio.com/product_tag-sitemap.xml 2026-09-15T09:07:52+00:00 https://redberryradio.com/genres-sitemap.xml 2026-05-22T16:27:40+00:00 https://redberryradio.com/rs-languages-sitemap.xml 2026-05-22T16:27:40+00:00 https://redberryradio.com/rbr_kb_category-sitemap.xml 2026-09-27T05:21:08+00:00 https://redberryradio.com/rbr_kb_label-sitemap.xml 2026-09-27T05:21:08+00:00