2011-11-25, 05:17 PM
Hello,
I wrote some plugins, usually I use objects or static methods in my plugins.
There is a big problem with MyBB 1.6.5, of course I read this:
http://community.mybb.com/thread-106729.html
but it isn't a problem for me.
Bad thing is this in inc/class_plugins.php:
How can I use object when I add my functions to hook?
Until today I've made that:
Inside plugin object:
example from view unread posts:
Or static method:
example from fast quote:
Now, both methods are invalid and display errors - it's normal, because my code is good for call_user_func_array, not for currently solution.
So, how can I use objects in my plugins to MyBB?
It must be possible, otherwise, I can throw into the trash a few months to correct and rewrite plugins
I wrote some plugins, usually I use objects or static methods in my plugins.
There is a big problem with MyBB 1.6.5, of course I read this:
http://community.mybb.com/thread-106729.html
but it isn't a problem for me.
Bad thing is this in inc/class_plugins.php:
$returnargs = $func($arguments);
How can I use object when I add my functions to hook?
Until today I've made that:
Inside plugin object:
$plugins->hooks["hook_name"][10]["my_func_name"] = array("function" => array($this, "my_func_name"));
example from view unread posts:
$plugins->hooks["search_start"][10]["up_doSearch"] = array("function" => array($this, "doSearch"));
Or static method:
$plugins->add_hook('hook_name','class_name::method_name');
example from fast quote:
$plugins->add_hook('postbit','fastQuote::addButton');
Now, both methods are invalid and display errors - it's normal, because my code is good for call_user_func_array, not for currently solution.
So, how can I use objects in my plugins to MyBB?
It must be possible, otherwise, I can throw into the trash a few months to correct and rewrite plugins