[wp-trac] [WordPress Trac] #3002: On Windows machines register_activation_hook() does not work if plugin is in a subfolder of the plugins dir

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 6 12:45:13 GMT 2006


#3002: On Windows machines register_activation_hook() does not work if plugin is
in a subfolder of the plugins dir
----------------------------+-----------------------------------------------
 Reporter:  McShelby        |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:           
Component:  Administration  |     Version:           
 Severity:  major           |    Keywords:           
----------------------------+-----------------------------------------------
 If you try to create a plugin in a subfolder of the 'plugins' directory
 and your are running Wordpress on a Windows machine, the function
 registered by register_activation_hook() will not be executed.

 This is because of different backslashes on UNIX and Windows and the way
 the function plugin_basename()/admin panel works.

 On Windows plugin_basename() returns the backslash in its return value
 while on Unix returning the slash. The plugins activation screen in the
 admin panel of Wordpress is always using slashes. You can easily see this
 by hovering over Askimets activate/deactivate button.

 register_activation_hook() is using plugin_basename() to install the
 activation filter while the file wp-admin/plugins.php will use the value
 from the plugins activation screen to access the installed filter. Because
 of different slash types, the filter will not be found and so will never
 be executed.

 If you take a look into the Bad Behaviour 2.0.4 plugin, you'll see from
 the comments that other guys have had the same problem with
 register_activation_hook().

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3002>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list