[wp-hackers] Plugin deactivation

Ryan Boren ryan at boren.nu
Mon Jul 4 02:15:52 GMT 2005


On Sun, 2005-07-03 at 22:02 -0400, Robert Deaton wrote:
> I agree that we need activation and deactivation hooks, and its a
> shame that it was pushed aside for 1.5.1 because its a feature I know
> a lot of plugin authors really would have liked to seen included. Is
> there any chance of getting the patch attached to 1052 included in the
> core?

Not that particular patch.  Every plugin listening for those events will
get them and think they are activating/deactivating.  It's a broadcast
to all plugins.  Won't work.  Attached is an old patch from April.  See
also:

http://comox.textdrive.com/pipermail/wp-hackers/2005-April/000377.html

Ryan

> On 7/3/05, Ryan Boren <ryan at boren.nu> wrote:
>         On Sun, 2005-07-03 at 20:52 -0400, Scott Merrill wrote:
>         > Terrence Wood wrote:
>         > > Is there any way for a plugin to determine when it's
>         deactivated so it
>         > > can run some cleanup code?
>         > >
>         > > I am testing a plugin that modifies .htaccess, and would
>         like to remove
>         > > some rewrite rules if the plugin is deactivated.
>         >
>         > Ticket 1052 was filed in early March:
>         >     http://trac.wordpress.org/ticket/1052
>         > 
>         > I see no reason not to add hooks for plugin_activated
>         > plugin_deactivated.  The hooks could even take as options
>         the name of
>         > the plugin being (de-)activated.
>         
>         That method won't work.  We'll probably need to use something
>         like the 
>         register_activation_hook(), register_deactivation_hook() stuff
>         I
>         proposed during the thread on overriding core functions.  We
>         pushed that
>         aside because we decided to go with the simpler
>         pluggable-functions.php
>         method for 1.5.1.  Maybe now is the time to investigate it
>         again.
>         
>         Ryan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: activate_hook.diff
Type: text/x-patch
Size: 2254 bytes
Desc: not available
Url : http://comox.textdrive.com/pipermail/wp-hackers/attachments/20050704/1e726b9a/activate_hook-0001.bin


More information about the wp-hackers mailing list