[wp-trac] Re: [WordPress Trac] #4389: Improve plugin activate and deactivate hooks

WordPress Trac wp-trac at lists.automattic.com
Mon Jun 4 16:55:13 GMT 2007


#4389: Improve plugin activate and deactivate hooks
--------------------------+-------------------------------------------------
 Reporter:  Otto42        |        Owner:  anonymous
     Type:  enhancement   |       Status:  reopened 
 Priority:  normal        |    Milestone:           
Component:  Optimization  |      Version:           
 Severity:  major         |   Resolution:           
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by Otto42):

  * status:  closed => reopened
  * resolution:  invalid =>

Comment:

 Replying to [comment:1 markjaquith]:
 > We have API for this.  You're not supposed to use the hooks directly.
 >
 > {{{
 > register_activation_hook(__FILE__, 'your_activation_function');
 > }}}
 >
 > By using {{{__FILE__}}}, you ensure that it will work no matter what
 name is given to the plugin.
 >
 > Please re-open if this doesn't address your concern.

 That call won't actually work though, will it? __FILE__ is the complete
 and absolute path of the php file, like /home/users/whatever/web/wp-
 content/plugins/myplugin.php or some such thing, whereas the actual hook
 looks like this:
 {{{
 @include(ABSPATH . PLUGINDIR . '/' . $plugin);
 ...
 do_action('activate_' . $plugin);
 }}}

 Sure looks like it's calling activate_myplugin.php instead, to me.

 So perhaps this ticket needs to be "Fix the broken API" instead?

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4389#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list