Plugin Directory

Changeset 3373949


Ignore:
Timestamp:
10/06/2025 08:03:21 PM (5 months ago)
Author:
alttextai
Message:

Fix permissions for non-admin users

Location:
alttext-ai/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • alttext-ai/trunk/README.txt

    r3371885 r3373949  
    66Requires at least: 4.7
    77Tested up to: 6.8
    8 Stable tag: 1.10.12
     8Stable tag: 1.10.13
    99WC requires at least: 3.3
    1010WC tested up to: 10.1
     
    7070== Changelog ==
    7171
     72= 1.10.13 - 2025-10-06 =
     73* Fixed: Non-administrator users can now save settings when given permission to access the plugin
     74
    7275= 1.10.12 - 2025-10-02 =
    7376* Improved: Better language detection for multilingual sites using WPML and Polylang
  • alttext-ai/trunk/admin/class-atai-settings.php

    r3359911 r3373949  
    196196
    197197  /**
     198   * Filter the capability required to save settings.
     199   *
     200   * @since    1.10.13
     201   * @access   public
     202   * @param    string    $capability    The default capability (manage_options).
     203   * @return   string    The configured capability.
     204   */
     205  public function filter_settings_capability( $capability ) {
     206    return get_option( 'atai_admin_capability', 'manage_options' );
     207  }
     208
     209  /**
    198210   * Register setting group.
    199211   *
     
    709721    }
    710722
    711     // Check user capabilities
    712     if ( ! current_user_can( 'manage_options' ) ) {
     723    // Check user capabilities using configured capability
     724    $required_capability = get_option( 'atai_admin_capability', 'manage_options' );
     725    if ( ! current_user_can( $required_capability ) ) {
    713726      wp_send_json_error( __( 'Insufficient permissions.', 'alttext-ai' ) );
    714727    }
  • alttext-ai/trunk/admin/partials/settings.php

    r3359911 r3373949  
    679679                    </select>
    680680                    <p class="mt-1 text-sm text-gray-500">
    681                       <?php esc_html_e( 'Control which user roles can access the AltText.ai menu.', 'alttext-ai' ); ?>
     681                      <?php esc_html_e( 'Control which user roles can access the AltText.ai menu and save settings.', 'alttext-ai' ); ?>
    682682                    </p>
    683683                  </div>
  • alttext-ai/trunk/atai.php

    r3371885 r3373949  
    1616 * Plugin URI:        https://alttext.ai/product
    1717 * Description:       Automatically generate image alt text with AltText.ai.
    18  * Version:           1.10.12
     18 * Version:           1.10.13
    1919 * Author:            AltText.ai
    2020 * Author URI:        https://alttext.ai
     
    3434 * Current plugin version.
    3535 */
    36 define( 'ATAI_VERSION', '1.10.12' );
     36define( 'ATAI_VERSION', '1.10.13' );
    3737
    3838/**
  • alttext-ai/trunk/changelog.txt

    r3371885 r3373949  
    11*** AltText.ai Changelog ***
     2
     32025-10-06 - version 1.10.13
     4* Fixed: Non-administrator users can now save settings when given permission to access the plugin
    25
    362025-10-02 - version 1.10.12
  • alttext-ai/trunk/includes/class-atai.php

    r3337936 r3373949  
    199199
    200200    $this->loader->add_filter( 'pre_update_option_atai_api_key', $settings, 'save_api_key', 10, 2 );
     201    $this->loader->add_filter( 'option_page_capability_atai-settings', $settings, 'filter_settings_capability' );
    201202
    202203    // Attachment
Note: See TracChangeset for help on using the changeset viewer.