[wp-hackers] readme.txt: "Requires PHP 5 tag"
    Stephen Rider 
    wp-hackers at striderweb.com
       
    Wed Jul 15 02:05:43 UTC 2009
    
    
  
That won't work for auto-updates (a plugin going from "works with PHP  
4+" to "works with PHP 5+").
The activation hook does not fire during auto update.
On Jul 14, 2009, at 3:41 PM, Otto wrote:
> Don't rely on users, they're invariably idiots. ;)
>
> Make your plugin smarter instead.
>
> /**
> * 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');
    
    
More information about the wp-hackers
mailing list