WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#37898 closed enhancement (duplicate)

Prompt message when removing a plugin is sometimes misleading

Reported by: bradt Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Plugins Keywords: shiny-updates has-screenshots needs-patch ui-feedback ux-feedback
Focuses: ui Cc:

Description

When you attempt to delete a plugin in 4.6, a JS prompt asks "Are you sure you want to delete <plugin name> and its data?" regardless whether or not there's an uninstall.php in the plugin that will actually delete plugin data.

This is misleading users as many plugins do not include uninstall.php files and do leave behind data.

Plugin authors also intentionally leave an uninstall.php out of their plugin and don't remove data to ensure users don't accidentally delete their data when upgrading a plugin via a "delete - upload new zip" process. This message will be confusing to those users who are trying to upgrade using this process without losing data.

The plugin delete prompt prior to 4.6 would detect whether an uninstall.php file exists in the plugin and only change the messaging to say that data would be deleted if the uninstall.php existed.

Attachments (2)

Screen Shot 2016-08-31 at 3.57.53 PM.png (78.1 KB) - added by bradt 4 years ago.
Screen Shot 2016-08-31 at 4.31.05 PM.png (69.0 KB) - added by bradt 4 years ago.

Download all attachments as: .zip

Change History (10)

#1 @bradt
4 years ago

  • Keywords shiny-updates has-screenshots needs-patch ui-feedback ux-feedback added

#2 @swissspidy
4 years ago

  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 4.6

Hey there,

Thanks for reporting this! The confirmation dialog has been added as part of Shiny Updates, where plugin deletion was now made shiny.

It's not that difficult to make the text context-aware, but with #20578 in mind it would make sense to not use a simple JS confirm() dialog but a custom modal with three options (uninstall completely, delete only, cancel) Tempted to close this one as a duplicate.

#3 follow-up: @OriginalEXE
4 years ago

Not even the existence of uninstall.php can guarantee that the plugin will remove its data (it could be used for something else), I think that's worth thinking about.

#4 in reply to: ↑ 3 @swissspidy
4 years ago

Replying to OriginalEXE:

Not even the existence of uninstall.php can guarantee that the plugin will remove its data (it could be used for something else), I think that's worth thinking about.

Uhm yes, that's what this file is for. It should definitely not be used for something else.

See https://developer.wordpress.org/plugins/the-basics/uninstall-methods/

#5 @mordauk
4 years ago

I'd love to see https://developer.wordpress.org/reference/functions/is_uninstallable_plugin/ get a filter so that plugins can override it.

Right now the determination of whether a plugin should uninstall its data is far too binary. It's either "yes" or "no", there is no "maybe". A plugin is deemed as uninstallable by the presence of uninstall.php, but what a plugin that should be capable of uninstalling its data but the choice needs to be left up to the site administrator?

It's very common for site admins to delete plugins and then immediately re-install the same plugin (perhaps a different version). In order to be good citizens, plugin authors are encouraged to cleanup after themselves and delete their data with uninstall.php, but what about scenarios where you want to give the site admin the choice of cleaning up the data?

I don't believe determining whether data should be deleted on the simple presence of a file is enough. I typically offer site admins the choice of deleting data through a setting like this:

https://cldup.com/cZMyJT1xq6-3000x3000.png

And then in the uninstall.php only deleting the data if that option is checked.

This works very well except it leaves the site admin with the misleading message that Brad initially mentioned. Even with the Remove Data on Uninstall option unchecked, site admins still see:
https://core.trac.wordpress.org/raw-attachment/ticket/37898/Screen%20Shot%202016-08-31%20at%204.31.05%20PM.png

If we could filter the uninstallable status for plugins, we could give an accurate message to site admins instead of the current, mis-leading message.

#6 @bradt
4 years ago

@mordauk I think for a plugin to be deleted it has to be deactivated first, and if it's deactivated its filters won't work.

I think the suggestion here is probably the way to go: https://core.trac.wordpress.org/ticket/20578#comment:42. I think you're right @swissspidy, we should close this as a dupe of #20578.

#7 @mordauk
4 years ago

Ah yes, doh.

#8 @swissspidy
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Alright, let's join efforts over at #20578.

Note: See TracTickets for help on using tickets.