[buddypress-trac] [BuddyPress] #2755: Remove deactivation hook

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sun Nov 21 17:22:36 UTC 2010

#2755: Remove deactivation hook
 Reporter:  boonebgorges  |       Owner:     
     Type:  defect        |      Status:  new
 Priority:  major         |   Milestone:  1.3
Component:  Core          |     Version:     
 Keywords:                |  

Comment(by jeffsayre):

 Since we've basically been debating the idea behind this ticket on
 Twitter, I thought it best to bring the discussion to were it belongs--
 this ticket.

 Here's a recap of some of my comments and thoughts on this issue:

 1. Plugin deactivation is different than plugin uninstalling. They are
 different events in WP's plugin API.

 2. There is value in deactivation routines. They can be used to allow Site
 Admin to reset the plugin's environment back to initial defaults without
 having to uninstall and then reinstall a plugin. But the resetting
 (deleting of) plugin meta data (the stored serialized options data)
 shouldn't be done automatically on deactivation. Site Admins should have
 control over if and when a plugin's meta data are reset.

 3. Whereas I have a function that hooks to register_deactivation_hook(),
 just as most (all?) BP plugins do, I disable all of the
 delete_site_option() and delete_option() calls and instruct admins to
 uncomment these lines if they need to reset the plugin's environment to
 default settings. This is bad and not user friendly.

 4. So, I've considered a more useful approach: create an Admin setting
 that allows the Site Admin to indicate whether meta data should be purged
 upon plugin deactivation. The function hooked to the deactivation event
 will use a constant to determine whether or not any delete_site_option()
 and delete_option() calls should be fired.

 5. Andrew Nacin suggested another approach which I believe is better.
 WordPress should have a "Defaults" button in the plugins menu that allows
 a Site Admin to easily restore a plugin back to its original factory
 settings with a simple push (and I assume with various warning messages
 and a confirmation button). This button is a nice idea, offers very clear
 meaning, and would obviate the need for a special function hooked to
 register_deactivation_hook(). Instead, there would need to be a function
 hooked to a new Plugin Defaults hook.

 6. The Plugin Defaults hook is something that would have to be added to
 WP's core, to the Plugin API (see: /wp-includes/plugin.php).

 So, if we go this route, this becomes a WP ticket and not a BP ticket.

Ticket URL: <http://trac.buddypress.org/ticket/2755#comment:2>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list