[wp-hackers] Stop activation request

Peter peter at avirtualhome.com
Thu Feb 7 13:10:42 GMT 2008


On Thu, 07 Feb 2008 13:38:02 +1100
DD32 <wordpress at dd32.id.au> wrote:

> I cant find my previous posting on it..
> 
> But, As of 2.4/2.5 at least its easier to deactivate a plugin.
> http://trac.wordpress.org/ticket/5210
> 
> 
> Simply register a activation hook:
> register_activation_hook(__FILE__, 'plugin_Activation_hook_here');
> 
> function plugin_Activation_hook_here(){
> 
> if( <Check if other plugin is installed> || <Check PHP extension
> required is installed> ){ return; //Return, let the plugin activate.
> } else {
> //A requirement isnt met!
> deactivate_plugins(__FILE__); //Deactivate ourself
> wp_die("ERROR! You have not met a requirement of this plugin"); //add
> a more descriptive message of course. }
> 
> }//end function
> 
> 
> In 2.3 you need to do some array funky-ness to remove the plugins
> file from the active_plugins option array as the deactvate_plugins()
> function doesnt exist.
> 
> 
Ok, thanks for the quick response. I'll look into that. Now I can't
'till 2.5 comes out :)

-- 
Peter van der Does

GPG key: E77E8E98
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Jabber ID: pvanderdoes at gmail.com

GetDeb Package Builder
http://www.getdeb.net - Software you want for Ubuntu


More information about the wp-hackers mailing list