Plugin Directory

Opened 6 years ago

#1526 new defect

[ sponsors-slideshow-widget] register_uninstall_hook called incorrectly

Reported by: kitchin Owned by:
Priority: normal Severity: normal
Plugin: not-listed Keywords: sponsors-slideshow-widget uninstall


From WP 3.3.2 in DEBUG mode:

Notice: register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.) in .../wp-includes/functions.php on line 3587

The offending code is at sponsors-slideshow-widget.php, line 57:

register_uninstall_hook(__FILE__, array(&$this, 'uninstall'));

Apparently uninstall never worked when called this way, and http://core.trac.wordpress.org/ticket/13786 added the warning and an early return.

Sponsors Slideshow Widget has been at wordpress.org since [297357] but is not a listed component. http://www.wordpress.org/extend/plugins/sponsors-slideshow-widget

This simple patch should work (sorry, don't have SVN):

  1. delete line 57
  2. add a new file, uninstall.php:
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
delete_option( 'sponsors_slideshow_widget' );
  1. For cleanup, delete the "uninstall" function at line 312.
  1. Also, fix a typo at line 344:
    // wp_register_script( 'sponsors-slideshow', $this->plugin_url.'/sponsors-slideshow-widget.js', array(), $ths->version );
    wp_register_script( 'sponsors-slideshow', $this->plugin_url.'/sponsors-slideshow-widget.js', array(), $this->version );

Change History (0)

Note: See TracTickets for help on using tickets.