[wp-hackers] How do I prevent activation of plugin is below PHP5?

Piyush Mishra me at piyushmishra.com
Fri Jul 9 11:04:47 UTC 2010


here is what otto wrote
/**
 * plugin_activation_check()
 *
 * Replace "plugin" with the name of your plugin
 */
function plugin_activation_check(){
       if (version_compare(PHP_VERSION, '5.0.0', '<')) {
               deactivate_plugins(basename(__FILE__)); // Deactivate ourself
               wp_die("Sorry, but you can't run this plugin, it
requires PHP 5 or higher.");
       }
}
register_activation_hook(__FILE__, 'plugin_activation_check');



On 7/9/10, Raj <list at expost.org> wrote:
> Otto replied? I didn't get it. Will check in the hackers archive.
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Piyush Mishra
> Sent: Friday, July 09, 2010 1:12 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] How do I prevent activation of plugin is below
> PHP5?
>
> see otto's reply :)
> the other(not recomended) way is to remove ur plugin from active
> plugins list in options table
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


-- 
Regards
Piyush Mishra
http://www.piyushmishra.com/
Life's Short, Live it to the maximum


More information about the wp-hackers mailing list