WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] register_uninstall_hook was called incorrectly (19 posts)

  1. maweder
    Member
    Posted 1 year ago #

    nextgen-gallery-v1.9.8 (nggallery.php)

    // Register a uninstall hook to remove all tables & option automatic
    register_uninstall_hook( $this->plugin_name, array('nggLoader', 'uninstall') );

    Changed to ...

    nextgen-gallery-v1.9.9 (nggallery.php)

    // Register a uninstall hook to remove all tables & option automatic
    register_uninstall_hook( $this->plugin_name, array(&$this, 'uninstall') );

    The wp-debugger reports a problem:

    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.

    Why the change? v1.9.8 has worked correctly.

    The actual wp-function (v3.5) ...

    function register_uninstall_hook( $file, $callback ) {
    	if ( is_array( $callback ) && is_object( $callback[0] ) ) {
    		_doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1' );
    		return;
    	}
    	...
    }

    Best regards

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. jenstho
    Member
    Posted 1 year ago #

    Got the same error. Any reason i should not change it back to 1.9.8?

  3. maweder
    Member
    Posted 1 year ago #

    Hi @jenstho,

    The 'error reports' appears only in debug mode (function _doing_it_wrong -> The current behavior is to trigger a user error if WP_DEBUG is true).

    And the v1.9.9 has important fixes. See the changelog: Fixed: Compatibility with WordPress v3.5 ( wpdb->prepare() warnings )

  4. jenstho
    Member
    Posted 1 year ago #

    Nice. Thanks for the reply:)

  5. photocrati
    Member
    Plugin Author

    Posted 1 year ago #

    @jenstho, @maweder, - We just released v1.9.10 that should resolve this error.

  6. lil_bugga
    Member
    Posted 1 year ago #

    @photocrati I've installed the update and still get this message "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 2944"

  7. ZjanPreijde
    Member
    Posted 1 year ago #

    Because unfortunately, they changed nothing, or the change was not incorporated in the update by mistake.
    Just change
    register_uninstall_hook( $this->plugin_name, array(&$this, 'uninstall')
    back into
    register_uninstall_hook( $this->plugin_name, array('nggLoader', 'uninstall')
    in nggallery.php

  8. antys
    Member
    Posted 1 year ago #

    Thank you! now it's running correctly!

  9. lil_bugga
    Member
    Posted 1 year ago #

    Cheers Zjan, if there was a kudos/rep button I'd have given you a boost :)

  10. g6valj
    Member
    Posted 1 year ago #

    Tnx ZjanPreijde (y)

  11. jafin
    Member
    Posted 1 year ago #

    Thanks guys. 1.9.10 was still giving this error.

  12. theKiwi
    Member
    Posted 1 year ago #

    >Just change
    register_uninstall_hook( $this->plugin_name, array(&$this, 'uninstall')
    back into
    register_uninstall_hook( $this->plugin_name, array('nggLoader', 'uninstall')

    This is not quite correct - there are more ( than ) …

    register_uninstall_hook( $this->plugin_name, array('nggLoader', 'uninstall') );

    seems to be correct for the whole line 79 in nggallery.php

    Roger

  13. ZjanPreijde
    Member
    Posted 1 year ago #

    Yes, you're right ofcourse. Sorry about that.
    But I missed the ');' in both lines, so technically it is still correct :-)

  14. Jbyrd117
    Member
    Posted 1 year ago #

    I am having similar problems. I just tried Zjan's solution and I'll see how it goes.

    Before I found this thread I made a topic here: http://wordpress.org/support/topic/nextgen-gallery-deprecated-call?

  15. photocrati
    Member
    Plugin Author

    Posted 1 year ago #

    Hey Everyone,

    Would you all mind downloading and installing our most recent Beta (found here) and let us know if the error still displays for you?

    If its still displaying, please submit your bug report here with temp. login credentials for your site so we may dig deeper into what is causing this to happen for some, but not all users. Many thanks!

  16. bwoff
    Member
    Posted 1 year ago #

    i get that message as well regarding uninstall_hook. could this cause a conflict with other plugins? for instance, my fast secure contact form no longer works and i cant find out why. it just keeps refreshing and doesn't send message.

    anyone with nextgen and nextgen optimizer have any conflicts with other plugins?

    i definitely dont want to delete nextgen, but i want a contact form as well.

  17. vidhill
    Member
    Posted 1 year ago #

  18. bwoff
    Member
    Posted 1 year ago #

    this uninstall_hook error doesn't seem to cause any problems for me. i only discovered it while trying to debug my contact form. am i missing something i should be aware of, or can i just wait until the author fixes it?

    thanks...

  19. sunildhanda
    Member
    Posted 11 months ago #

    You need to write class in string instead of passing $this, i.e.

    register_uninstall_hook( __FILE__, array('your_class_name', 'your_class_method') );

    As you see the if condition below, the first parameter of callback must not be an object.

    function register_uninstall_hook( $file, $callback ) {
    	if ( is_array( $callback ) && is_object( $callback[0] ) ) {
    		_doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1' );
    		return;
    	}
    	...
    }

    For more help Visit here

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic