Plugin Directory

Changeset 3417090


Ignore:
Timestamp:
12/11/2025 08:03:32 AM (4 months ago)
Author:
appwavedev
Message:

Add disable attachments toggle to admin settings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bettercx-widget/trunk/bettercx-widget.php

    r3417078 r3417090  
    495495
    496496        add_settings_field(
     497            'is_attachments_disabled',
     498            __('Disable Attachments', 'bettercx-widget'),
     499            array($this, 'is_attachments_disabled_field_callback'),
     500            'bettercx-widget',
     501            'bettercx_widget_advanced'
     502        );
     503
     504        add_settings_field(
    497505            'custom_css',
    498506            __('Custom CSS', 'bettercx-widget'),
     
    583591        $sanitized['widget_enabled'] = isset($input['widget_enabled']) ? (bool) $input['widget_enabled'] : true;
    584592        $sanitized['logged_in_only'] = isset($input['logged_in_only']) ? (bool) $input['logged_in_only'] : false;
     593        $sanitized['is_attachments_disabled'] = isset($input['is_attachments_disabled']) ? (bool) $input['is_attachments_disabled'] : false;
    585594
    586595        if (isset($input['custom_css'])) {
     
    625634            'base_url' => $this->settings['base_url'],
    626635            'ai_service_url' => $this->settings['ai_service_url'],
     636            'is_attachments_disabled' => $this->settings['is_attachments_disabled'] ? 'true' : 'false',
    627637            'class_name' => '',
    628638            'style' => '',
     
    723733                'base-url' => true,
    724734                'ai-service-url' => true,
     735                'is-attachments-disabled' => true,
    725736                'class' => true,
    726737                'style' => true,
     
    10651076        <p class="description">
    10661077            <?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'); ?>
     1078        </p>
     1079        <?php
     1080    }
     1081
     1082    public function is_attachments_disabled_field_callback() {
     1083        $value = isset($this->settings['is_attachments_disabled']) ? (bool) $this->settings['is_attachments_disabled'] : false;
     1084        ?>
     1085        <label>
     1086            <input type="checkbox" name="bettercx_widget_settings[is_attachments_disabled]" value="1" <?php checked($value, true); ?> />
     1087            <?php esc_html_e('Hide attachment uploads in the chat composer', 'bettercx-widget'); ?>
     1088        </label>
     1089        <p class="description">
     1090            <?php esc_html_e('When enabled, users will not see the image upload button in the widget composer.', 'bettercx-widget'); ?>
    10671091        </p>
    10681092        <?php
Note: See TracChangeset for help on using the changeset viewer.