WordPress.org

Make WordPress Core

Ticket #13591: garyc40.13591.diff

File garyc40.13591.diff, 2.4 KB (added by garyc40, 7 years ago)
  • wp-admin/includes/class-wp-themes-list-table.php

    diff --git wp-admin/includes/class-wp-themes-list-table.php wp-admin/includes/class-wp-themes-list-table.php
    index 97ae61c..ceab971 100644
    class WP_Themes_List_Table extends WP_List_Table { 
    114114        function display_rows() {
    115115                $themes = $this->items;
    116116                $theme_names = array_keys( $themes );
     117                $page = $this->get_pagenum();
    117118                natcasesort( $theme_names );
    118119
    119120                $table = array();
    foreach ( $cols as $col => $theme_name ) { 
    154155        $preview_text = esc_attr( sprintf( __( 'Preview of “%s”' ), $title ) );
    155156        $tags = $themes[$theme_name]['Tags'];
    156157        $thickbox_class = 'thickbox thickbox-preview';
    157         $activate_link = wp_nonce_url( "themes.php?action=activate&template=".urlencode( $template )."&stylesheet=".urlencode( $stylesheet ), 'switch-theme_' . $template );
     158       
     159        $activate_link_args = array(
     160                'action'     => 'activate',
     161                'template'   => urlencode( $template ),
     162                'stylesheet' => urlencode( $stylesheet ),
     163        );
     164        if ( $page > 1 )
     165                $activate_link_args['paged'] = $page;
     166
     167        $activate_link = wp_nonce_url( add_query_arg( $activate_link_args, 'themes.php' ), "switch-theme_{$template}" );
    158168        $activate_text = esc_attr( sprintf( __( 'Activate “%s”' ), $title ) );
    159169        $actions = array();
    160170        $actions[] = '<a href="' . $activate_link .  '" class="activatelink" title="' . $activate_text . '">' . __( 'Activate' ) . '</a>';
  • wp-admin/themes.php

    diff --git wp-admin/themes.php wp-admin/themes.php
    index ea36c4b..a8ac3e8 100644
    if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { 
    1818        if ( 'activate' == $_GET['action'] ) {
    1919                check_admin_referer('switch-theme_' . $_GET['template']);
    2020                switch_theme($_GET['template'], $_GET['stylesheet']);
    21                 wp_redirect( admin_url('themes.php?activated=true') );
     21                $sendback = $wp_list_table->add_query_args( admin_url( 'themes.php?activated=true' ) );
     22                wp_redirect( $sendback );
    2223                exit;
    2324        } elseif ( 'delete' == $_GET['action'] ) {
    2425                check_admin_referer('delete-theme_' . $_GET['template']);
    2526                if ( !current_user_can('delete_themes') )
    2627                        wp_die( __( 'Cheatin&#8217; uh?' ) );
    2728                delete_theme($_GET['template']);
    28                 wp_redirect( admin_url('themes.php?deleted=true') );
     29                $sendback = $wp_list_table->add_query_args( admin_url( 'themes.php?deleted=true' ) );
     30                wp_redirect( $sendback );
    2931                exit;
    3032        }
    3133}