On 24 Mar 2010, at 18:17, due chiacchiere wrote:

> Hi all,
> 
> I'm working on a plugin which needs to store some data in the table 
> "wp_options", and to create some new tables as well. I have two questions:
> 
> 1) Why calling add_option('myoption', array(), 'no') creates a new entry that 
> has the 'autoload' field set to YES in the database? Am I doing something 
> wrong?
> 
> 2) Since I want to be a 'good developer', I added the uninstall function to 
> be executed whenever the user decides to remove this plugin from his WP box. 
> So I have this method inside my class:
> 
> public function uninstall() {
>        global $wpdb;
> 
>        // Goodbye data...
>        $wpdb->query("DROP TABLE IF EXISTS `tablename`");
> 
>        // Goodbye options...
>        delete_option('myoption');
>    }
> 
> And then it's hooked like this
> 
> register_uninstall_hook( __FILE__, array( &$myclass, 'uninstall' ) );
> 
> I've tried both with 2.9 and 3.0alpha, and the table is still there after I 
> uninstall the plugin via the admin interface.
> 

Without looking at the code I suspect this will be due to using a class 
function for this hook when it is likely that when the hook is called the class 
does not exist.

>From memory the activation/uninstall hooks can only work with functions not 
>class functions.

Cheers

Peter
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5

_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers

Reply via email to