[wp-trac] [WordPress Trac] #61330: Plugin Dependencies: Refresh plugin-install.php instead of redirecting on activation

WordPress Trac noreply at wordpress.org
Tue Jun 4 13:46:20 UTC 2024


#61330: Plugin Dependencies: Refresh plugin-install.php instead of redirecting on
activation
------------------------------------------------+--------------------------
 Reporter:  jorbin                              |       Owner:  (none)
     Type:  enhancement                         |      Status:  new
 Priority:  normal                              |   Milestone:  6.7
Component:  Upgrade/Install                     |     Version:
 Severity:  normal                              |  Resolution:
 Keywords:  2nd-opinion has-patch dev-feedback  |     Focuses:
                                                |  administration
------------------------------------------------+--------------------------

Comment (by jorbin):

 I briefly explored doing this server side. This approach isn't quite
 perfect because it redirects to the modal as a full screen page but it
 doesn't have the two issues that the approached patch has. I would be up
 for exploring it and fixing the one issue during beta if another committer
 is ok with it.

 {{{
 diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php
 index 7045f16661..dcb2d594e4 100644
 --- a/src/wp-admin/plugins.php
 +++ b/src/wp-admin/plugins.php
 @@ -78,11 +78,14 @@ if ( $action ) {
                                 update_site_option( 'recently_activated',
 $recent );
                         }

 +
                         if ( isset( $_GET['from'] ) && 'import' ===
 $_GET['from'] ) {
                                 // Overrides the ?error=true one above and
 redirects to the Imports page, stripping the -importer suffix.
                                 wp_redirect( self_admin_url(
 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) )
 ) );
                         } elseif ( isset( $_GET['from'] ) && 'press-this'
 === $_GET['from'] ) {
                                 wp_redirect( self_admin_url( 'press-
 this.php' ) );
 +                       } elseif ( str_contains( wp_get_referer(), 'wp-
 admin/plugin-install.php' ) ) {
 +                               wp_redirect( wp_get_referer() );
                         } else {
                                 // Overrides the ?error=true one above.
                                 wp_redirect( self_admin_url(
 "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s" ) );
 }}}

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


More information about the wp-trac mailing list