MyBB Community Forums
Hooks Explained/Example? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Hooks Explained/Example? (/thread-193977.html)



Hooks Explained/Example? - Nuance - 06-08-2016

I've read over some resources and other questions, but since I don't know PHP I can't fully grasp how to hook a variable from one page to another page for MyBB. I face this problem often, so I think it would be beneficial to at least know the concept.

As a current example I've loosely followed this tutorial and made a working registration modal that shows on all pages. Now the problem I'm facing is the problem the tutorial ignored, not having a working captcha. If you use captcha you can't register without completing it and since its variable {$regimage} doesn't work outside of member.php, the tutorial chose to disable captcha all together. I would feel safer having it though. It appears that my answer may be here, but it's a specific question and again I have no idea of how to implement that into my php files.

I haven't found a lot of information on this for beginners, so would someone mind possibly using my example and explaining how hooks are used to make a variable from one page work in another page?


RE: Hooks Explained/Example? - m0ckingbird - 06-08-2016

This might help you..
http://community.mybb.com/thread-137925.html


RE: Hooks Explained/Example? - Nuance - 06-08-2016

(06-08-2016, 09:15 AM)delay Wrote: This might help you..
http://community.mybb.com/thread-137925.html

Yea I actually read through that, and though it's a great guide I think the way plugins and pages use hooks are different. Correct me if I'm wrong, but I tried a hook from that tutorial and it just broke my page.


RE: Hooks Explained/Example? - nth - 06-08-2016

Show us code.

Also, a list of hooks are here: http://docs.mybb.com/1.8/development/plugins/hooks/