• Hi, I am writing a new plugin based on a none-wordpress class that I have once created.
    On my main plugin page I have an install function, that I wish to hook to the plugin registration action with register_activation_hook.

    So inside the class my function name is: ztree_install.
    This is my code:

    if( class_exists( 'Ztree_plugin' ) ) {
    	global $wpdb;
    	$the_ztree = new Ztree_plugin($wpdb);
    	register_activation_hook( __FILE__, array( &$the_ztree, 'ztree_installl' );
    }

    But at activating the plugin I get an error message:
    “Warning: call_user_func_array(): First argument is expected to be a valid callback, ‘create_books’ was given in /mnt/sites/matomysendbox.com/htdocs/wp-includes/plugin.php on line 405 Parse error: syntax error, unexpected ‘;’ in /mnt/sites/matomysendbox.com/htdocs/wp-content/plugins/ztree_forum/ztree_forum.php on line 61 “

    Any idea where do I go wrong?
    Many thanks in advance,
    Michal

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can we see the ztree_installl function, and/or the create_books function (or perhaps where you called it)?

    Is the function we’re looking at here line 61?

    Those pieces of information will be helpful to figure out what’s going wrong. 🙂

    Thread Starter Kermit524

    (@kermit524)

    Ai Anne, thanks for your comment!
    The ztree_install function only included one line to verify that it was called at all.
    But eventually it turned out to be a false alarm. The error message was thrown in fact due to a completely different issue, that was not handled right in my code. I have sorted that one out – and all is working fine!
    Thanks again,
    Michal

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘register_activation_hook error on oop plugin’ is closed to new replies.