[wp-trac] [WordPress Trac] #31136: Allow plugin authors to register an additional 'Uninstall Notification' plugin header and to display back to the user during plugin uninstall flow (was: Allow plugins to register a string to show to user when uninstalling/deleting plugin)

WordPress Trac noreply at wordpress.org
Fri Feb 27 17:35:11 UTC 2015


#31136: Allow plugin authors to register an additional 'Uninstall Notification'
plugin header and to display back to the user during plugin uninstall flow
-------------------------------------------------+-------------------------
 Reporter:  cefiar                               |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Plugins                              |  Review
 Severity:  normal                               |     Version:
 Keywords:  has-patch dev-feedback 2nd-opinion   |  Resolution:
  needs-testing                                  |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------
Changes (by eherman24):

 * keywords:  needs-patch => has-patch dev-feedback 2nd-opinion needs-
               testing
 * focuses:   => administration


Comment:

 In the patch that I have attached above, I've added one additional plugin
 header meta data, 'Uninstall Notification'.

 This allows the user to display a notice back to the user just before
 uninstalling a plugin. This could be useful for things such as linking to
 the support forum in the repository, asking nicely for a review or any
 other number of use cases.

 In the following screenshot you can see that I've tested the 'Uninstall
 Notification' within the 'Askismet' plugin.

 Here is the example plugin header with the patch that I have attached
 implemented :


 {{{
 /**
  * @package Akismet
  */
 /*
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Used by millions, Akismet is quite possibly the best way in
 the world to <strong>protect your blog from comment and trackback
 spam</strong>. It keeps your site protected from spam even while you
 sleep. To get started: 1) Click the "Activate" link to the left of this
 description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet
 API key</a>, and 3) Go to your Akismet configuration page, and save your
 API key.
 Version: 3.0.4
 Author: Automattic
 Author URI: http://automattic.com/wordpress-plugins/
 License: GPLv2 or later
 Text Domain: akismet
 Uninstall Notification: Here we are testing an uninstall notification.
 This could be anything ranging from asking for a review to a link to the
 repository support forums. <ul> <li><a href="#">Sample Link</a></li>
 <li><a href="#">Sample Link #2</a> </li> </ul>
 */
 }}}

 You'll notice the new metadata just below 'Text Domain'.

 And here is the notification displayed back to the user during the plugin
 uninstall work flow :

 [[Image(https://i.cloudup.com/m_JVm1dUoy.png)]]

 As validation I've implemented wp_kses with the same html tags allowed
 within a standard post. This allows for specific html tags to be used such
 as `<a>`,`<em>`,`<br />` and `<strong>` while stripping away anything
 malicious.

 I've added the styles for the notification to `wp-
 admin/css/dashboard.css`, which may not be the correct location for it.
 I'm open to suggestions and alterations, but believe this would be a solid
 addition to the plugin uninstall flow.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31136#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list