Plugins: Show "Activate" after updating an inactive plugin from Add Plugins - #13163
Plugins: Show "Activate" after updating an inactive plugin from Add Plugins#13163wprashed wants to merge 1 commit into
Conversation
…dd Plugins screen. When updating an inactive plugin from the Add Plugins screen (Plugins > Add New), the button remained in the disabled "Updated!" state instead of transitioning to "Activate", requiring users to navigate to Installed Plugins to activate it. This updates `wp_ajax_update_plugin()` to return `activateUrl` for inactive plugins that the current user has permission to activate, matching `wp_ajax_install_plugin()`. It also updates `wp.updates.updatePluginSuccess` to check plugin dependencies and transform the button to an "Activate" link, and updates `checkPluginDependenciesSuccess` / `checkPluginDependenciesError` to handle `.update-now` buttons alongside `.install-now`. Fixes #65909.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac Ticket
https://core.trac.wordpress.org/ticket/65909
Description
When updating an inactive plugin from the Add Plugins screen (Plugins > Add New), the button currently remains as a disabled "Updated!" state. Users must navigate to the Installed Plugins screen to activate it.
This PR brings consistency with the plugin installation flow: after successfully updating an inactive plugin, the button changes to "Activate" (or "Network Activate").
The Changes
wp_ajax_update_plugin()(src/wp-admin/includes/ajax-actions.php):activateUrlgeneration when the updated plugin is inactive and the current user has theactivate_plugincapability (matching the logic inwp_ajax_install_plugin()).wp.updates.updatePluginSuccess(src/js/_enqueues/wp/updates.js):wp.updates.checkPluginDependencies()whenresponse.activateUrlis present in the response.wp.updates.checkPluginDependenciesSuccess&wp.updates.checkPluginDependenciesError(src/js/_enqueues/wp/updates.js):.update-nowalongside.install-nowso update buttons seamlessly transform into.activate-nowbuttons.How to Test
Fixes #65909.