[wp-hackers] PHP 5 only plugin

Otto otto at ottodestruct.com
Mon Apr 14 18:38:17 GMT 2008


If you explicitly say that it's PHP 5 only in the plugin description,
and add some code like this to it, then you won't get as many support
issues.

function myplugin_activation_check(){
	// check to see if this plugin will even work
	if (version_compare("5.0", phpversion(), ">")) {
		deactivate_plugins(basename(__FILE__)); // Deactivate ourself
		wp_die("ERROR! You can't run this plugin. It requires PHP 5 or above.");
	}
}
register_activation_hook(__FILE__, 'myplugin_activation_check');

And there you go. When they try to activate it, they get told a big
fat "no" and it fails to activate as well. Simple.


On Mon, Apr 14, 2008 at 12:57 PM, Ozh <ozh at planetozh.com> wrote:
> You can do whatever you want. It's your plugin (and your support time
>  with people on PHP4 webhosts)
>
>
>
>  On Mon, Apr 14, 2008 at 7:45 PM, Per Søderlind <per at soderlind.no> wrote:
>  > Can I ditch PHP 4 or is it a bit early ?
>  >
>  >  ../PerS
>  >
>  >  _______________________________________________
>  >  wp-hackers mailing list
>  >  wp-hackers at lists.automattic.com
>  >  http://lists.automattic.com/mailman/listinfo/wp-hackers
>  >
>
>
>
>  --
>  http://FrenchFragFactory.net ~ Daily Quake News
>  http://planetOzh.com ~ Blog and WordPress Stuff
>
>
> _______________________________________________
>  wp-hackers mailing list
>  wp-hackers at lists.automattic.com
>  http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list