(As posted at http://timvw.madoka.be/?p=535)
The WordPress documentation says that you have to call add_action(’activate_pluginurl’, ’somefunction’) to trigger somefunction when your plugin is activated. Unfortunately i couldn’t find with what pluginurl should be replaced. After a bit of experimenting i’ve found that in wp-admin/plugins.php the following is called when a plugin is activated:
do_action(‘activate_’ . trim( $_GET[‘plugin’] ));
So it appears that you simply have to use the path of your plugin relative to /wp-content/plugins. Eg: you have a plugin in /wp-content/plugins/wp-spamfilter/wp-spamfilter.php then you have to call add_action as following:
Is this conclusion right? Perhaps the documentation could better explain what exactly mypluginurl is...