WordPress.org

Make WordPress Core

Changeset 48451


Ignore:
Timestamp:
07/12/2020 01:20:58 PM (2 months ago)
Author:
SergeyBiryukov
Message:

Plugins: Make delete plugin message less scary.

This adds a check if the plugin actually has an uninstall routine before saying that its data will be deleted too.

Props samful, joostdevalk, joyously, Chouby, SergeyBiryukov.
Fixes #50346.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/updates.js

    r48418 r48451  
    21392139        $bulkActionForm.on( 'click', '[data-plugin] a.delete', function( event ) {
    21402140            var $pluginRow = $( event.target ).parents( 'tr' ),
     2141                confirmMessage;
     2142
     2143            if ( $pluginRow.hasClass( 'is-uninstallable' ) ) {
    21412144                confirmMessage = sprintf(
    21422145                    /* translators: %s: Plugin name. */
     
    21442147                    $pluginRow.find( '.plugin-title strong' ).text()
    21452148                );
     2149            } else {
     2150                confirmMessage = sprintf(
     2151                    /* translators: %s: Plugin name. */
     2152                    __( 'Are you sure you want to delete %s?' ),
     2153                    $pluginRow.find( '.plugin-title strong' ).text()
     2154                );
     2155            }
    21462156
    21472157            event.preventDefault();
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r48418 r48451  
    943943        }
    944944
     945        if ( is_uninstallable_plugin( $plugin_file ) ) {
     946            $class .= ' is-uninstallable';
     947        }
     948
    945949        printf(
    946950            '<tr class="%s" data-slug="%s" data-plugin="%s">',
Note: See TracChangeset for help on using the changeset viewer.