'Normal (real entitlement)', 'free' => 'Free', 'trial_active' => 'Trial Active', 'trial_expired' => 'Trial Expired', 'pro' => 'Pro', ); } } if ( ! function_exists( 'matewa_founder_qa_is_available' ) ) { function matewa_founder_qa_is_available() { return function_exists( 'matewa_founder_beta_is_active' ) && matewa_founder_beta_is_active(); } } if ( ! function_exists( 'matewa_founder_qa_get_mode' ) ) { function matewa_founder_qa_get_mode() { if ( ! matewa_founder_qa_is_available() ) { return 'normal'; } $mode = sanitize_key( (string) get_option( MATEWA_FOUNDER_QA_MODE_OPTION, 'normal' ) ); $allowed = matewa_founder_qa_allowed_modes(); return isset( $allowed[ $mode ] ) ? $mode : 'normal'; } } if ( ! function_exists( 'matewa_founder_qa_forced_license_mode' ) ) { function matewa_founder_qa_forced_license_mode( $real_mode ) { $qa_mode = matewa_founder_qa_get_mode(); if ( 'normal' === $qa_mode ) { return $real_mode; } $map = array( 'free' => defined( 'MATEWA_MODE_FREE' ) ? MATEWA_MODE_FREE : 'free', 'trial_active' => defined( 'MATEWA_MODE_TRIAL' ) ? MATEWA_MODE_TRIAL : 'trial_active', 'trial_expired' => defined( 'MATEWA_MODE_TRIAL_EXPIRED' ) ? MATEWA_MODE_TRIAL_EXPIRED : 'trial_expired', 'pro' => defined( 'MATEWA_MODE_PRO' ) ? MATEWA_MODE_PRO : 'pro', ); return isset( $map[ $qa_mode ] ) ? $map[ $qa_mode ] : $real_mode; } } add_filter( 'matewa_force_license_mode', 'matewa_founder_qa_forced_license_mode', 999 ); if ( ! function_exists( 'matewa_founder_qa_save_mode' ) ) { function matewa_founder_qa_save_mode() { if ( ! is_admin() || ! current_user_can( 'manage_options' ) || ! matewa_founder_qa_is_available() ) { wp_die( esc_html__( 'You are not allowed to change the Founder QA state.', '247chatmate' ) ); } check_admin_referer( 'matewa_founder_qa_save' ); $requested = isset( $_POST['matewa_founder_qa_mode'] ) ? sanitize_key( wp_unslash( $_POST['matewa_founder_qa_mode'] ) ) : 'normal'; $allowed = matewa_founder_qa_allowed_modes(); if ( ! isset( $allowed[ $requested ] ) ) { $requested = 'normal'; } update_option( MATEWA_FOUNDER_QA_MODE_OPTION, $requested, false ); /* * Founder QA is frequently exercised on cached production/staging sites. * When previewing Free, force the saved placement to the Free contract * and clear page targeting so the widget is immediately sitewide. */ if ( in_array( $requested, array( 'free', 'trial_expired' ), true ) ) { $widget_settings = get_option( 'matewa_widget_settings', array() ); $widget_settings = is_array( $widget_settings ) ? $widget_settings : array(); $widget_settings['enabled'] = '1'; $widget_settings['display_mode'] = 'all'; $widget_settings['page_ids'] = array(); $widget_settings['include_homepage'] = '0'; update_option( 'matewa_widget_settings', $widget_settings, false ); } // Clear WordPress/object caches plus common page-cache integrations. if ( function_exists( 'wp_cache_flush' ) ) { wp_cache_flush(); } if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); } if ( function_exists( 'w3tc_flush_all' ) ) { w3tc_flush_all(); } if ( has_action( 'litespeed_purge_all' ) ) { do_action( 'litespeed_purge_all' ); } if ( function_exists( 'wpfc_clear_all_cache' ) ) { wpfc_clear_all_cache( true ); } $url = add_query_arg( array( 'page' => '247chatmate-founder-qa', 'matewa_qa_saved' => '1', ), admin_url( 'admin.php' ) ); wp_safe_redirect( $url ); exit; } } add_action( 'admin_post_matewa_founder_qa_save', 'matewa_founder_qa_save_mode' ); if ( ! function_exists( 'matewa_render_founder_qa_page' ) ) { function matewa_render_founder_qa_page() { if ( ! current_user_can( 'manage_options' ) || ! matewa_founder_qa_is_available() ) { wp_die( esc_html__( 'Founder QA is only available on an active Founder Beta installation.', '247chatmate' ) ); } $current = matewa_founder_qa_get_mode(); $allowed = matewa_founder_qa_allowed_modes(); ?>
Test product state updated.
Temporarily preview how this installation behaves in another product state. Your real Founder entitlement and licence data are left untouched.