Plugin Directory

Changeset 3445584


Ignore:
Timestamp:
01/23/2026 12:50:34 PM (2 months ago)
Author:
bmarshall511
Message:

Version 5.6.2 - Fix incorrect Enhanced Protection admin notice

  • fix(admin): resolved issue where 'Advanced Protection is enabled but not licensed' notice displayed incorrectly when Enhanced Protection was disabled
  • fix(admin): corrected Settings API usage in admin notices for consistency with dashboard widget
  • fix(admin): added support for ZEROSPAM_LICENSE_KEY constant check in admin notice logic
  • fix(debug): removed testing debug statements

Resolves incorrect admin notice display when Enhanced Protection is disabled.

Location:
zero-spam/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zero-spam/trunk/core/admin/class-admin.php

    r3443488 r3445584  
    118118     */
    119119    public function admin_notices() {
    120         error_log( '========== ZERO SPAM ADMIN_NOTICES START ==========' );
    121        
    122120        // Clean up old transients from previous implementation (temporary cleanup code).
    123121        $current_user_id = get_current_user_id();
     
    125123            error_log( 'Cleaned up old transient: zerospam_promo_shown_' . $current_user_id );
    126124        }
    127        
    128         // Only display notices for administrators.
    129         if ( ! current_user_can( 'administrator' ) ) {
    130             error_log( 'EXITING: User is not administrator' );
    131             error_log( '========== ZERO SPAM ADMIN_NOTICES END ==========' );
    132             return;
    133         }
    134        
    135         error_log( 'User IS administrator, continuing...' );
    136 
    137         // Get the Enhanced Protection settings directly from the options.
    138         $zerospam_settings    = get_option( 'zero-spam-zerospam', array() );
    139         error_log( 'Settings from DB: ' . print_r( $zerospam_settings, true ) );
    140        
    141         $zerospam_enabled     = ! empty( $zerospam_settings['zerospam'] ) && 'enabled' === $zerospam_settings['zerospam'];
    142         error_log( 'Enhanced Protection Enabled: ' . ( $zerospam_enabled ? 'YES' : 'NO' ) );
    143        
    144         $zerospam_license_key = ! empty( $zerospam_settings['zerospam_license'] ) ? $zerospam_settings['zerospam_license'] : false;
    145         error_log( 'License Key Present: ' . ( $zerospam_license_key ? 'YES' : 'NO' ) );
     125
     126        // Get the Enhanced Protection settings using the Settings API for consistency.
     127        $settings = \ZeroSpam\Core\Settings::get_settings();
     128       
     129        // Check if Enhanced Protection is enabled.
     130        $zerospam_enabled = isset( $settings['zerospam']['value'] ) && 'enabled' === $settings['zerospam']['value'];
     131       
     132        // Check for license key - include constant check like the settings definition does.
     133        $zerospam_license_key = false;
     134        if ( defined( 'ZEROSPAM_LICENSE_KEY' ) && ZEROSPAM_LICENSE_KEY ) {
     135            $zerospam_license_key = ZEROSPAM_LICENSE_KEY;
     136        } elseif ( ! empty( $settings['zerospam_license']['value'] ) ) {
     137            $zerospam_license_key = $settings['zerospam_license']['value'];
     138        }
    146139
    147140        // Display enhanced promo notice or error notice based on state.
    148141        if ( $zerospam_enabled && ! $zerospam_license_key ) {
    149             error_log( 'BRANCH 1: Enhanced ON + No License = show ERROR notice' );
    150142            // Enhanced Protection enabled but no license key - show error.
    151143            $this->display_license_error_notice();
    152144        } elseif ( ! $zerospam_enabled && ! $zerospam_license_key ) {
    153             error_log( 'BRANCH 2: Enhanced OFF + No License = show PROMO notice' );
    154145            // Enhanced Protection disabled and no license - show promo notice.
    155146            $this->display_promo_notice();
    156         } else {
    157             error_log( 'BRANCH 3: No notice needed (has license or other condition)' );
    158147        }
    159148
    160149        // Check if the plugin has been auto-configured.
    161150        $configured = get_option( 'zerospam_configured' );
    162         error_log( 'Plugin configured: ' . ( $configured ? 'YES' : 'NO' ) );
    163         error_log( '========== ZERO SPAM ADMIN_NOTICES END ==========' );
    164151       
    165152        if ( ! $configured ) {
  • zero-spam/trunk/readme.txt

    r3443721 r3445584  
    66Tested up to: 6.9
    77Requires PHP: 8.2
    8 Stable tag: 5.6.1
     8Stable tag: 5.6.2
    99License: GPL v2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    107107
    108108== Changelog ==
     109
     110= v5.6.2 =
     111
     112* fix(admin): resolved issue where "Advanced Protection is enabled but not licensed" notice displayed incorrectly when Enhanced Protection was disabled
     113* fix(admin): corrected Settings API usage in admin notices for consistency with dashboard widget
     114* fix(admin): added support for ZEROSPAM_LICENSE_KEY constant check in admin notice logic
     115* fix(debug): removed testing debug statements
    109116
    110117= v5.6.1 =
  • zero-spam/trunk/wordpress-zero-spam.php

    r3443721 r3445584  
    1616 * Plugin URI:        https://wordpress.com/plugins/zero-spam/
    1717 * Description:       Tired of all the ineffective WordPress anti-spam & security plugins? Zero Spam for WordPress makes blocking spam &amp; malicious activity a cinch. <strong>Just activate, configure, and say goodbye to spam.</strong>
    18  * Version:           5.6.1
     18 * Version:           5.6.2
    1919 * Requires at least: 6.9
    2020 * Requires PHP:      8.2
     
    3434define( 'ZEROSPAM_PATH', plugin_dir_path( ZEROSPAM ) );
    3535define( 'ZEROSPAM_PLUGIN_BASE', plugin_basename( ZEROSPAM ) );
    36 define( 'ZEROSPAM_VERSION', '5.6.1' );
     36define( 'ZEROSPAM_VERSION', '5.6.2' );
    3737
    3838if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
Note: See TracChangeset for help on using the changeset viewer.