WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 6 days ago

#50346 accepted enhancement

Make delete plugin message less scary

Reported by: joostdevalk Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch needs-testing
Focuses: Cc:

Description

When we ask people to test new or RC versions of Yoast SEO, they are often scared to delete the plugin through the admin, as the delete message says:

"Are you sure you want to delete %s and its data?"

The thing is: Yoast SEO does _not_, in fact, delete its data when you delete the plugin as that would lead to a lot of headaches everywhere. Can we make that string dependent on whether the plugin actually is an uninstallable plugin, per is_uninstallable_plugin? So when the plugin does not have an uninstall.php, can we change the sentence to just:

"Are you sure you want to delete %s?"

We actually already have that sentence for themes, so it shouldn't add any translation burden.

Attachments (4)

50346.diff (2.1 KB) - added by samful 6 days ago.
adds classes "has-plugin-data" and "no-plugin-data" that allow the JS to display a different un-install message
no-plugin-data-class-added.png (60.7 KB) - added by samful 6 days ago.
deleting-plugin-with-data.png (46.0 KB) - added by samful 6 days ago.
deleting-plugin-without-data.png (46.3 KB) - added by samful 6 days ago.

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
4 weeks ago

  • Milestone changed from Awaiting Review to 5.5
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#2 @joyously
4 weeks ago

Does this mean the opposite message is changed also? For those plugins that have an uninstall hook?
I recently thought my analytics plugin didn't update correctly, so I uninstalled it and re-installed. There was no message that doing that deleted all the data it had accumulated. (I found it later in the plugin's page, but it would have been nice to know while I was doing it, since I didn't remember that little detail I must have read long ago.)
Or maybe the message was there (the one you are wanting to change) and it didn't register in my mind that it would affect anything. I'm not even sure I read it, since I've done similar so many times.

#3 @Chouby
12 days ago

Having a different message based on the presence of the file uninstall.php would be a good progress. It would be even better if the message could be controlled by the plugin in case there is a file uninstall.php, as in most cases, deleting the data is optional. For example WooCommerce controls this with an option https://github.com/woocommerce/woocommerce/blob/4.2.1/uninstall.php#L28.

#4 @samful
6 days ago

  • Keywords has-patch needs-testing added

Adding a patch which sets a class on the delete <a> delete element, based on the wordpress is_uninstallable_plugin() function. All the PHP I could see seems to use this to identify if the plug-in has data or not, however the JavaScript used no such logic at all.

By adding a "has-plugin-data" or "no-plugin-data" class to the <a> element, the JavaScript can display a different message. Hope this helps, Please see screenshots and test :)

@samful
6 days ago

adds classes "has-plugin-data" and "no-plugin-data" that allow the JS to display a different un-install message

Note: See TracTickets for help on using tickets.