The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
plugin question- how to override code in a hook location
So I'm now to using plugins in place of direct php file edits. I have code I want to put into a hook location but I need to execute my code and NOT execute the existing code... for example I make a pligin in: example_hook_location
My code is: PHP Code:
PHP Code:
PHP Code:
--------------- Added [DATE]1277949347[/DATE] at [TIME]1277949347[/TIME] --------------- In more detail what I want to do is "If" something is true use my custom code for a query, otherwise (if false) use the existing code... One of the hook locations I want to do this with is: forumdisplay_query_threadscount I'd be much obliged for pointers on how to do this, I read an article on plugins but it was very old and couldn't find much dealing with my issue in the search. |
#2
|
|||
|
|||
I know this is probably something you've looked at already, but are you able to define the variable at a later hook to override the previous variable?
If not, why not just add another hook in the location? This seems the easiest method... |
#3
|
||||
|
||||
You would mist likely have to replicate the query from the file in your plugin and use your variable with that. No way to do what you are asking that I am aware of, unless you could do it in a later hook.
|
#4
|
|||
|
|||
Or just add:
PHP Code:
Code:
<hook>hook_name</hook> Code:
<hooktype type="forumdisplay"> <hook>forumdisplay_start</hook> <hook>forumdisplay_moderator</hook> <hook>forumdisplay_loggedinuser</hook> <hook>forumdisplay_announcement_query</hook> <hook>forumdisplay_announcement</hook> <hook>forumdisplay_sort</hook> <hook>forumdisplay_query_threadscount</hook> <hook>forumdisplay_query_threadid</hook> <hook>forumdisplay_query</hook> <hook>forumdisplay_complete</hook> </hooktype> |
#5
|
||||
|
||||
That kind of defeats the purpose of using plugin hooks. Why not just do the code in the file? You would have to re-do it on an upgrade anyway.
|
#6
|
|||
|
|||
Because by putting in a plugin hook all he is doing is creating a way of accessing the variable, he can disable/enable the plugin at his will.
|
#7
|
||||
|
||||
And he still needs to re-do the files on every upgrade. 6 to 1, a half dozen to the other.
|
#8
|
||||
|
||||
Thanks for the ideas... I guess it's not worth doing if I have to make another hook location because the code edits aren't that hard, I just thought maybe I could make the edits via hooks so i could release a product file instead of manual changes for a mod I made.
Oh well... at least (i think) I've figured out how hooks work for future mods. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|