#50346 closed defect (bug) (fixed)
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 (5)
Change History (15)
#1
@
5 years ago
- Milestone changed from Awaiting Review to 5.5
- Owner set to SergeyBiryukov
- Status changed from new to accepted
#3
@
5 years 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
@
4 years 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 :)
@
4 years ago
adds classes "has-plugin-data" and "no-plugin-data" that allow the JS to display a different un-install message
#5
@
4 years ago
I'd prefer adding "Its data won't be deleted" to the second option. That's the whole idea of making it less scary :)
#6
follow-up:
↓ 8
@
4 years ago
How would you feel about adding "If the plugin has data, this will not be deleted." to the second option? As some uninstallable plugins won't actually have data, am I right?
For example, when users uninstall the "Hello Dolly" plugin maybe they'll be confused if we say "it's data won't be deleted" as it has no data...
@
4 years ago
fixed issue where plugin only worked on multisites and changed message to "If the plugin has data, this will not be deleted."
#7
in reply to:
↑ description
@
4 years ago
- Type changed from enhancement to defect (bug)
Replying to joostdevalk:
Can we make that string dependent on whether the plugin actually is an uninstallable plugin, per
is_uninstallable_plugin
?
I remember this was the case in older releases. There are already some is_uninstallable_plugin()
checks in the code, it looks like they don't work as expected or something is missing to leverage them properly.
So this appears to a be a regression in recent releases, apparently in Shiny Updates introduced in [37714] / #31773. Reclassifying as a bug.
#8
in reply to:
↑ 6
;
follow-up:
↓ 10
@
4 years ago
Replying to samful:
How would you feel about adding "If the plugin has data, this will not be deleted." to the second option? As some uninstallable plugins won't actually have data, am I right?
Wanted to go with this, but it sounds like the plugin itself won't be deleted if it has any data.
Let's just go with "Are you sure you want to delete %s?" for the initial iteration and see if any further adjustments to the message could be made.
#10
in reply to:
↑ 8
@
4 years ago
Replying to SergeyBiryukov:
Replying to samful:
How would you feel about adding "If the plugin has data, this will not be deleted." to the second option? As some uninstallable plugins won't actually have data, am I right?
Wanted to go with this, but it sounds like the plugin itself won't be deleted if it has any data.
Let's just go with "Are you sure you want to delete %s?" for the initial iteration and see if any further adjustments to the message could be made.
Thinking about this some more, is_uninstallable_plugin()
only checks for:
- Whether the plugin has an uninstall hook added via
register_uninstall_hook()
. - Whether the plugin has an
uninstall.php
file.
It does not, however, check whether the plugin has a deactivation hook added via register_deactivation_hook()
.
As noted in the plugin handbook, deleting the plugin data on the deactivation hook is not recommended. However, it could technically still be done, in which case saying the data won't be deleted would be a promise we can't keep, as that statement would not be accurate.
Something like an additional check for has_action( 'deactivate_{$plugin_file}' )
might work, but may not account for any edge cases if the file used for register_deactivation_hook()
is not the same as the main plugin file.
So [48451] seems good enough for now.
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.