From a47ba9f685493aeff3809647355fdb0bd27f14d9 Mon Sep 17 00:00:00 2001 From: OpenClaw Assistant Date: Mon, 2 Mar 2026 21:42:24 +0300 Subject: [PATCH] fix(paradiz-web): show chat widget for guests without login --- .../paradiz-web-chat/paradiz-web-chat.php | 23 ++++++++++++++++++- memory/текущий-день.md | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/integrations/paradiz-web/wordpress-plugin/paradiz-web-chat/paradiz-web-chat.php b/integrations/paradiz-web/wordpress-plugin/paradiz-web-chat/paradiz-web-chat.php index 5a6e718..c7d2157 100644 --- a/integrations/paradiz-web/wordpress-plugin/paradiz-web-chat/paradiz-web-chat.php +++ b/integrations/paradiz-web/wordpress-plugin/paradiz-web-chat/paradiz-web-chat.php @@ -2,7 +2,7 @@ /** * Plugin Name: Paradiz Web Chat * Description: Чат-плагин для сайта vparadize.ru, который отправляет вопросы в изолированного агента OpenClaw paradizweb. - * Version: 1.0.0 + * Version: 1.0.4 * Author: EVA */ @@ -12,11 +12,14 @@ class ParadizWebChat { const OPT_ENDPOINT = 'paradizweb_endpoint'; const OPT_TOKEN = 'paradizweb_token'; + private $widget_rendered = false; + public function __construct() { add_action('admin_menu', [$this, 'admin_menu']); add_action('admin_init', [$this, 'register_settings']); add_shortcode('paradiz_web_chat', [$this, 'render_shortcode']); add_action('wp_enqueue_scripts', [$this, 'enqueue_assets']); + add_action('wp_footer', [$this, 'render_global_widget']); add_action('wp_ajax_paradiz_web_chat', [$this, 'handle_chat']); add_action('wp_ajax_nopriv_paradiz_web_chat', [$this, 'handle_chat']); } @@ -62,7 +65,25 @@ class ParadizWebChat { } public function render_shortcode() { + return $this->render_widget_markup(); + } + + public function render_global_widget() { + if (is_admin() || wp_doing_ajax() || $this->widget_rendered) { + return; + } + + echo $this->render_widget_markup(); + } + + private function render_widget_markup() { + if ($this->widget_rendered) { + return ''; + } + + $this->widget_rendered = true; wp_enqueue_script('paradiz-web-chat'); + ob_start(); ?>