The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Right way to install custom PHP code in the core vB PHP files
Hello everyone,
I've made a 'plugin' for my community (couple custom PHP files, some templates and tables) All is working great BUT. In order to use this plugin I need to add piece of code to the 'newthread.php' file, in this place (VB 4.1.12 PL3: Code:
271 else 272 { // something to do here 292 293 // ### NOT PREVIEW - ACTUAL POST ### 294 $threadinfo = fetch_threadinfo($newpost['threadid']); // need the forumread variable from this So, is there any easy way to install this code exactly in this place via some feature in Admin Panel? Or if there is no 'easy and nice way' to do this, tell me please if will it be any problem for vB when I leave this code there. (during installation/deinstallation of products? [i know about vB upgrades, when I need to fe. update the newthread.php file]) Thank you. /sorry for my english/ |
#2
|
|||
|
|||
If you can't figure out a way to do it using the existing hook locations, then you have no choice but to change the files. There isn't any way to do it from the admincp, so what you have done is ok. Vbulletin will tell you the file has been changed because that's what the feature does - it tells you if any files have been changed from the original. It won't cause any problems other than being reported as changed.
|
#3
|
|||
|
|||
Okey, I got this.
I rly do not care about diagnostics - just checked it for fun. I'm very happy there will be no problems - this is important for me. Thanks for the fast answer. Maybe sometime I'll study the hook engine, for now I will stay with my old-school 'hand made' style. Best regards from Poland Case closed. |
#4
|
|||
|
|||
Well, I thought maybe you had already looked for hook locations. It turns out there's one a couple lines after the "something to do here", so if it's not important to do it before those two lines, you might be able to use a plugin. In case you want to try, it would be hook location newthread_post_complete.
|
#5
|
|||
|
|||
Don't know what to say, but I moved this piece of code from 'newthread.php' to the new plugin with location newthread_post_complete and it's working.
So good software. Your hint was very helpful for me. Funny, because as you said the code: Code:
($hook = vBulletinHook::fetch_hook('newthread_post_complete')) ? eval($hook) : false; Very nice, 'newthread.php' restored and all is great. Found the right way Thank you very much. --------------- Added [DATE]1372376961[/DATE] at [TIME]1372376961[/TIME] --------------- /edit/ Didn't know this might be so easy. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|