Changeset 3409441
- Timestamp:
- 12/03/2025 12:08:10 PM (4 months ago)
- Location:
- bettercx-widget/trunk
- Files:
-
- 2 edited
-
bettercx-widget.php (modified) (10 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bettercx-widget/trunk/bettercx-widget.php
r3408542 r3409441 4 4 * Plugin URI: https://wordpress.org/plugins/bettercx-widget/ 5 5 * Description: Professional AI-powered chat widget for BetterCX platform. Seamlessly integrate intelligent customer support into any website with full WordPress compatibility. Fully functional out of the box with no trial limitations. 6 * Version: 1.0. 86 * Version: 1.0.9 7 7 * Author: BetterCX 8 8 * Author URI: https://bettercx.ai … … 16 16 * 17 17 * @package BetterCX_Widget 18 * @version 1.0. 818 * @version 1.0.9 19 19 * @author BetterCX 20 20 * @license GPLv2+ … … 37 37 38 38 // Define plugin constants 39 define('BETTERCX_WIDGET_VERSION', '1.0. 8');39 define('BETTERCX_WIDGET_VERSION', '1.0.9'); 40 40 define('BETTERCX_WIDGET_PLUGIN_FILE', __FILE__); 41 41 define('BETTERCX_WIDGET_PLUGIN_DIR', plugin_dir_path(__FILE__)); … … 175 175 'custom_css' => '', 176 176 'widget_enabled' => true, 177 'logged_in_only' => false, // Show widget only for logged-in users 177 178 'base_url' => 'https://api.bettercx.ai', 178 179 'ai_service_url' => 'https://ai.bettercx.ai', … … 212 213 // Only load if widget is enabled and we have a public key 213 214 if (!$this->settings['widget_enabled'] || empty($this->settings['public_key'])) { 215 return; 216 } 217 218 // Check if widget should only be shown to logged-in users 219 if (!empty($this->settings['logged_in_only']) && !is_user_logged_in()) { 214 220 return; 215 221 } … … 459 465 460 466 add_settings_field( 467 'logged_in_only', 468 __('Logged-in Users Only', 'bettercx-widget'), 469 array($this, 'logged_in_only_field_callback'), 470 'bettercx-widget', 471 'bettercx_widget_advanced' 472 ); 473 474 add_settings_field( 461 475 'custom_css', 462 476 __('Custom CSS', 'bettercx-widget'), … … 535 549 $sanitized['privacy_consent'] = isset($input['privacy_consent']) ? (bool) $input['privacy_consent'] : false; 536 550 $sanitized['widget_enabled'] = isset($input['widget_enabled']) ? (bool) $input['widget_enabled'] : true; 551 $sanitized['logged_in_only'] = isset($input['logged_in_only']) ? (bool) $input['logged_in_only'] : false; 537 552 538 553 if (isset($input['custom_css'])) { … … 559 574 */ 560 575 public function widget_shortcode($atts) { 576 // Check if widget should only be shown to logged-in users 577 if (!empty($this->settings['logged_in_only']) && !is_user_logged_in()) { 578 return ''; 579 } 580 561 581 // Parse shortcode attributes 562 582 $atts = shortcode_atts(array( … … 619 639 // Only render if widget is enabled and we have a public key 620 640 if (!$this->settings['widget_enabled'] || empty($this->settings['public_key'])) { 641 return; 642 } 643 644 // Check if widget should only be shown to logged-in users 645 if (!empty($this->settings['logged_in_only']) && !is_user_logged_in()) { 621 646 return; 622 647 } … … 939 964 echo '<input type="checkbox" name="bettercx_widget_settings[privacy_consent]" value="1" ' . checked($value, true, false) . ' />'; 940 965 echo '<p class="description">' . esc_html__('Require explicit user consent before enabling analytics and data collection.', 'bettercx-widget') . '</p>'; 966 } 967 968 public function logged_in_only_field_callback() { 969 $value = isset($this->settings['logged_in_only']) ? (bool) $this->settings['logged_in_only'] : false; 970 ?> 971 <label> 972 <input type="checkbox" name="bettercx_widget_settings[logged_in_only]" value="1" <?php checked($value, true); ?> /> 973 <?php esc_html_e('Show widget only to logged-in users', 'bettercx-widget'); ?> 974 </label> 975 <p class="description"> 976 <?php esc_html_e('When enabled, the widget will only be displayed to users who are logged into WordPress. This is useful for member-only sites or applications with authentication.', 'bettercx-widget'); ?> 977 </p> 978 <?php 941 979 } 942 980 -
bettercx-widget/trunk/readme.txt
r3408542 r3409441 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 87 Stable tag: 1.0.9 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 244 244 245 245 == Changelog == 246 247 = 1.0.9 = 248 * Added "Logged-in Users Only" option to restrict widget visibility to authenticated WordPress users 249 * Enhanced security with WordPress native authentication check using is_user_logged_in() 250 * Optimized performance - scripts and styles only load for logged-in users when option is enabled 251 * Perfect for member-only sites and applications with WordPress authentication 252 * Works with both standard wp-login.php and custom login forms 246 253 247 254 = 1.0.8 = … … 325 332 == Upgrade Notice == 326 333 334 = 1.0.9 = 335 New feature: Added "Logged-in Users Only" option in Advanced Settings. Perfect for member-only sites - widget will only display to authenticated WordPress users. Optimized for performance with early script loading prevention. 336 327 337 = 1.0.8 = 328 338 Important mobile fix: Enhanced mobile keyboard handling for perfect input behavior. Chat now properly adjusts when keyboard appears, providing smooth UX on all mobile devices. … … 581 591 582 592 = Version = 583 1.0. 8593 1.0.9 584 594 585 595 = Minimum WordPress Version = … … 596 606 597 607 = Stable Tag = 598 1.0. 8608 1.0.9 599 609 600 610 = Development Version = 601 1.0. 8611 1.0.9 602 612 603 613 = Requires at least =
Note: See TracChangeset
for help on using the changeset viewer.