[wp-trac] [WordPress Trac] #61269: Plugin Dependencies: Add filter to restore auto-redirect after plugin activation

WordPress Trac noreply at wordpress.org
Thu May 23 17:27:14 UTC 2024


#61269: Plugin Dependencies: Add filter to restore auto-redirect after plugin
activation
-------------------------------------------------+-------------------------
 Reporter:  hellofromTonya                       |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.5.4
Component:  Upgrade/Install                      |     Version:  6.5
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing needs-dev-note has-    |     Focuses:
  patch has-testing-info                         |  administration
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  needs-testing needs-testing-info needs-dev-note has-patch =>
     needs-testing needs-dev-note has-patch has-testing-info


Comment:

 = Testing Instructions

 These steps define how to reproduce the issue, and indicate the expected
 behavior.

 Patch: https://github.com/WordPress/wordpress-develop/pull/6606

 Testing WooCommerce with this PR applied (including the fix to not show
 the "Refresh now" https://github.com/WordPress/wordpress-
 develop/pull/6606/commits/dc013d3e1abbf3a826c02794d7e0c6b006d268ab) and
 sample code added to the plugin.

 == Set up

 Patch: https://github.com/WordPress/wordpress-develop/pull/6606

 Plugin with onboarding | set up | configure experience that auto-
 redirected after activation before WP 6.5.0 (e.g. Elementary, WooCommerce,
 BuddyPress, bbPress, OptinMonster, WPForms, etc.):
 1. Install the plugin, but do not activate it yet.
 2. Open its main plugin PHP file.
 3. After the plugin header DocBlock and ` after `defined( 'ABSPATH' ) ||
 exit;` (if this exists), copy and paste the following code:

 {{{#!php
 add_filter( 'plugin_configuration_data_{the-plugin-slug}', static
 function() {
         return array(
                 'url' => admin_url( 'the-url-to-redirect-to' ),
         );
 } );
 }}}

 For example, if testing WooCommerce:
 * Open `plugins/woocommerce/woocommerce.php` file.
 * Copy and paste the following the code after `defined( 'ABSPATH' ) ||
 exit;`:

 {{{#!php
 add_filter( 'plugin_configuration_data_woocommerce', static function() {
         return array(
                 'url' => admin_url( 'admin.php?page=wc-admin' ),
         );
 } );

 }}}

 == Steps to Test in the Add Plugins UI:

 1. Navigate to Plugins > Add New Plugin.
 2. In the plugins search box, type the name of the plugin you're testing
 (e.g. `woocommerce`) and press enter. The UI should populate with that and
 associated plugins.
 3. In the plugin's card, press the "Activate" button.

 **Expected Results:**
 After activation:
 * the "Refresh now" admin notice and button should not appear.
 * the site should redirect to plugin's onboarding wizard | set up or
 configure page.

 == Steps to Test in the More Details modal:
 Note: Deactivate the plugin first.

 1. Navigate to Plugins > Add New Plugin.
 2. In the plugins search box, type the name of the plugin you're testing
 (e.g. `woocommerce`) and press enter. The UI should populate with that and
 associated plugins.
 4. In the plugin's card, click on the "More Details" link below the
 "Activation" button.
 5. Press the "Activate" button (may need to scroll down to the button).

 **Expected Results:**
 After activation:
 * at the bottom of the modal, the "Refresh now" admin notice and button
 should not appear.
 * the site should redirect to the onboarding wizard | set up or configure
 page.

 == Steps to Test another plugin that requires the plugin you're testing
 Note: Deactivate the plugin first.

 Example: When searching for WooCommerce plugins to add, notice there are
 several dependent upon WooCommerce, such as WooCommerce Stripe Payment
 Gateway.

 The instructions will be for WooCommerce. But it's the same steps for
 others such as Elementor.

 1. Navigate to Plugins > Add New Plugin.
 2. In the plugins search box, type `woocommerce` and press enter. The UI
 should populate with that and associated plugins.
 3. In the plugin's card, click on the "More Details" link below the
 "Activation" button.
 4. For one of the plugins requiring WooCommerce (such as WooCommerce
 Stripe Payment Gateway):
   4.1 Press the "Install Now" button.
   4.2 After installed, notice unable to activate the plugin. This is by
 design as it requires WooCommerce.
   4.3 In the "Additional plugins are required" section, click
 WooCommerce's "More Details" link.
   4.4 In the modal, press the "Activate" button. Expected: WooCommerce's
 onboarding wizard should load.
   4.5 In your browser, click the button to navigate back to the Add
 Plugins UI. Expected: WooCommerce Stripe Payment Gateway plugin can now be
 activated.
   4.6 Activate the plugin.

 **Expected Results:**
 After activation of WooCommerce:
 * at the bottom of the modal, the "Refresh now" admin notice and button
 should not appear.
 * the site should redirect to the onboarding wizard | set up or configure
 page.
 After navigating back to the Add Plugins UI, plugins requiring WooCommerce
 are now able to be activated.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61269#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list