![]() |
Can I run custom hooks from a plugin? - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Extensions (https://community.mybb.com/forum-201.html) +--- Forum: Plugins (https://community.mybb.com/forum-73.html) +---- Forum: Plugin Development (https://community.mybb.com/forum-68.html) +---- Thread: Can I run custom hooks from a plugin? (/thread-127014.html) Pages:
1
2
|
Can I run custom hooks from a plugin? - TOA - 2012-10-02 I tried adding a custom hook to one of my plugins so I can add stuff to the page with other plugins. I'm having no luck getting anything to work. Am I able to call custom hooks from a plugin? Or just regular hooks even? Here's my code where I want to run the hook
And here's the code I'm trying to add to that hook
I get no errors, but no matter what I do in my other plugin, I can't get my content to display. Thanks for reading. SOLVED - Stupid spelling errors! RE: Can I run custom hooks from a plugin? - Euan T - 2012-10-02 Try something like this:
Then hook into it with
That should work ![]() RE: Can I run custom hooks from a plugin? - TOA - 2012-10-02 (2012-10-02, 03:46 PM)euantor Wrote: Try something like this: Thanks! That does work. It was a spelling error; I mis-spelled 'exercise' in the run_hooks call ![]() RE: Can I run custom hooks from a plugin? - Omar G. - 2012-10-02 Unless your variable is in the global scope, you need to pass it by reference, just as Euantor showed you. Though, slighter different, I will do it like this:
RE: Can I run custom hooks from a plugin? - Euan T - 2012-10-02 @Omar surely there's no need to do it that way? Since you're passing it by reference anyway... RE: Can I run custom hooks from a plugin? - Omar G. - 2012-10-02 Yep, there is no real need ![]() RE: Can I run custom hooks from a plugin? - Euan T - 2012-10-02 Ah, fair enough. So long as it works is all that matter xD RE: Can I run custom hooks from a plugin? - TOA - 2012-10-02 ![]() RE: Can I run custom hooks from a plugin? - Leefish - 2012-10-02 (2012-10-02, 04:54 PM)Omar G. Wrote: Unless your variable is in the global scope, you need to pass it by reference, just as Euantor showed you. Sorry to hijack, but what do you mean by global scope Omar? I have seen this referred to a couple of times now. RE: Can I run custom hooks from a plugin? - Euan T - 2012-10-02 By global scope, he means that the variable is accessible via the $GLOBALS superglobal array I believe. |