[wp-hackers] Re: Activate Action not Working?

ozgreg wphackers at galleryembedded.com
Sat Apr 28 01:09:56 GMT 2007

I use both activate and deactivate hooks via this small piece of code.  Beware WP got some concerns around the unix style slashing etc..  (someone has an open bugtrac tricket about this)

//Activate & Deactivate Plugin Functions
$plugin_filename= str_replace('\\', '/', preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__));
$file = plugin_basename($plugin_filename);
add_action('activate_' . $file, 'wpg2_pluginactivate');
add_action('deactivate_' . $file, 'wpg2_plugindeactivate');

Hope this helps..

WPG2 Installation, Operation & FAQ Documentation (http://wpg2.galleryembedded.com/)

-------------------- m2f --------------------

Gallery2 Embedded Forums (http://www.galleryembedded.com/forums/)
-------------------- m2f --------------------

More information about the wp-hackers mailing list