Changeset 3382121
- Timestamp:
- 10/21/2025 06:03:12 PM (5 months ago)
- Location:
- abtestkit/trunk
- Files:
-
- 2 edited
-
abtestkit.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
abtestkit/trunk/abtestkit.php
r3380834 r3382121 2 2 /** 3 3 * Plugin Name: abtestkit 4 * Plugin URI: https:// github.com/abtestkit4 * Plugin URI: https://wordpress.org/plugins/abtestkit 5 5 * Description: Simple, in-editor testing for WordPress Core Editor (Gutenberg). 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Author: abtestkit 8 8 * License: GPL-2.0-or-later … … 79 79 return [ 80 80 'plugin' => 'abtestkit', 81 'version' => '1.0. 0',81 'version' => '1.0.1', 82 82 'site' => md5( home_url() ), // anonymous hash 83 83 'wp' => get_bloginfo( 'version' ), … … 104 104 105 105 // ─────────────────────────────────────────────────────────── 106 // One-time redirect + "onboarding complete" flag 106 // One-time redirect + "onboarding complete" flag (hardened) 107 107 // ─────────────────────────────────────────────────────────── 108 108 register_activation_hook( __FILE__, 'abtestkit_activate_onboarding' ); 109 109 function abtestkit_activate_onboarding() { 110 if ( ! get_option( 'abtestkit_onboarding_done' ) ) { 110 // Create the "done" flag if missing 111 if ( get_option( 'abtestkit_onboarding_done', null ) === null ) { 111 112 add_option( 'abtestkit_onboarding_done', '0' ); 112 113 } 113 add_option( 'abtestkit_do_activation_redirect', '1' ); 114 } 115 114 // Set the one-time redirect flag 115 update_option( 'abtestkit_do_activation_redirect', '1', true ); 116 } 117 118 /** 119 * Some activation paths don’t reliably run the activation callback in the 120 * same request pipeline that lands you back in wp-admin. This ensures the 121 * flag is still set right after the specific plugin is activated. 122 */ 123 add_action( 'activated_plugin', function( $plugin ) { 124 if ( $plugin === plugin_basename( __FILE__ ) ) { 125 update_option( 'abtestkit_do_activation_redirect', '1', true ); 126 } 127 }, 10, 1 ); 128 129 /** 130 * Perform the one-time redirect as soon as we’re safely in admin. 131 */ 116 132 add_action( 'admin_init', function () { 117 if ( '1' === get_option( 'abtestkit_do_activation_redirect' ) ) { 118 delete_option( 'abtestkit_do_activation_redirect' ); 119 120 // Avoid redirect loops / bulk activations / Ajax 121 if ( ! wp_doing_ajax() && ! isset( $_GET['activate-multi'] ) ) { 122 wp_safe_redirect( admin_url( 'admin.php?page=abtestkit-get-started' ) ); 123 exit; 124 } 125 } 133 // Only once 134 if ( '1' !== get_option( 'abtestkit_do_activation_redirect' ) ) { 135 return; 136 } 137 138 // Clear the flag immediately to avoid loops 139 delete_option( 'abtestkit_do_activation_redirect' ); 140 141 // Don’t redirect in these contexts 142 if ( wp_doing_ajax() ) return; 143 if ( is_network_admin() ) return; // Multisite network screens 144 if ( isset( $_GET['activate-multi'] ) ) return; // Bulk activate 145 146 // Only redirect admins who can actually view the page 147 if ( ! current_user_can( 'manage_options' ) ) return; 148 149 // Final hop to the hidden onboarding screen 150 $url = admin_url( 'admin.php?page=abtestkit-get-started' ); 151 wp_safe_redirect( $url ); 152 exit; 126 153 } ); 127 154 … … 163 190 plugins_url( 'assets/js/onboarding.js', __FILE__ ), 164 191 array( 'wp-element', 'wp-components', 'wp-api-fetch' ), 165 '1.0. 0',192 '1.0.1', 166 193 true 167 194 ); … … 1232 1259 'appsScriptUrl' => ABTESTKIT_EMAIL_APPS_SCRIPT, // includes ?key=... 1233 1260 'plugin' => 'abtestkit', 1234 'version' => '1.0. 0',1261 'version' => '1.0.1', 1235 1262 // Base fields so GAS fills standard columns 1236 1263 'site' => md5( home_url() ), -
abtestkit/trunk/readme.txt
r3380839 r3382121 5 5 Tested up to: 6.6 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 License: GPL-2.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 130 130 == Changelog == 131 131 132 = 1.0.1 = 133 * Fixed: Activation redirect now runs reliably so the onboarding wizard opens immediately after first activation. 134 * Improved: Activation logic hardened for multisite and bulk activation contexts. 135 * Minor: Internal code clean-up for future stability. 136 132 137 = 1.0.0 = 133 * Firstrelease of abtestkit — simple A/B testing inside the WordPress Core Editor.134 * Supported blocks: buttons, headings, paragraphs, images.138 * Initial public release of abtestkit — simple A/B testing inside the WordPress Core Editor. 139 * Supported blocks: buttons, headings, paragraphs, and images. 135 140 * Automatic winner declaration with Bayesian evaluation. 136 141 * Grouped test support. 137 * Opt -in anonymous telemetry.142 * Optional anonymous telemetry (opt-in). 138 143 139 144 == Upgrade Notice == 140 145 146 = 1.0.1 = 147 Fixes onboarding not opening automatically after activation and improves reliability on multisite setups. 148 Updating is strongly recommended to ensure a smooth first-time setup experience. 149 141 150 = 1.0.0 = 142 151 First public release — validate your ideas, grow your website, and reach your goals with A/B testing built directly into the WordPress block editor.
Note: See TracChangeset
for help on using the changeset viewer.