Tutorial Explanation
This tutorial will teach you how to use the plugin system to change default vBulletin queries, without touching the core code.
This tutorial is aimed at users who have an understanding of how the vBulletin plugin system works. Lets get started...
Lets pretend you have a table called.
pretenddata (with 2 fields)
---threadid
---data.
Use this to create the table and values:
You must first be a
registered member to view any code.
Now we have some info stored in that table, we want to show it next to the thread title. From 123.gif to 1234.gif. To do this you would have to hack the $threads query in forumdisplay.php around line 841.
Here is the $threads query
You must first be a
registered member to view any code.
The red code is what you would have to add in order to include the table pretenddata with this query.
Lets take a look at what I just did...
LEFT JOIN " . TABLE_PREFIX . "pretenddata AS pretenddata ON(pretenddata.threadis = thread.threadid) Join the table named pretenddata and rename is AS pretenddata. Now search all threadid fields in the pretenddata table and see if they match the threadid stored in the thread table. , pretenddata.data AS titleprefix
If they do get contant stored from the fieldname data and rename is AS titeprefix.
Using this method you will beable to show what ever data is in the data table by using this variable in the template threadbit: $thread['prefix']
When you vist threadid #1 it should look like this: 1234.gif
Now that you understand how it works when you hack the files, lets make it a plugin.
Right before that query you should see:
You must first be a
registered member to view any code.
And in the query you will see $hook_query_fields, $hook_query_joins, and $hook_query_where. All you have to do is give those variables some info.
Plugin Manager -> [Add New Plugin] ->
-> Hook Location = "forumdisplay_query"
-> Title = "Testing"
-> Plugin PHP Code =
You must first be a
registered member to view any code.
Now you have hacked that query without hacking the core code. ;)