[wp-hackers] prevent plugin activation if conditions are not met
viper at viper007bond.com
Sun Aug 31 16:46:48 GMT 2008
This is the code I use:
Basically on plugin load (not activation, just in general), I'd register a
"plugins_loaded" hook and that's it. Then inside your "plugins_loaded" hook,
I'd look for function from the other plugin. If it doesn't exist, register a
"admin_notices" hook (which outputs a friendly error message) and then
deactivate the plugin. If the function does exist, then you can continue
registering hooks, etc.
On Sun, Aug 31, 2008 at 7:45 AM, David Barbakadze <jayarjo at gmail.com> wrote:
> hello, people!
> I'm new to this list and to wordpress. nice to meet you therefore :)
> wordpress code really does look as a poetry.
> I'm working on a little add-on for NextGEN library. I'm writing it in
> the form of plugin, but I want to prevent it's activation if some
> confitions (installed NextGEN library) are not met. I'm able to throw
> an error message with admin_notices hook, but cannot stop activation
> process. Plugin does activate anyway. Then if I just do exit; it does
> prevent it, but throws rather non-informative message: Plugin could
> not be activated because it triggered a fatal error.
> Is there a trick to combine both of them. I mean to throw beautiful
> error and cancel plugin activation process?
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/
More information about the wp-hackers