The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
New Conditional in threadbit
My head is just swimming from looking at all these templates, variable names, etc. I'm in way over my head here.
Nevertheless, here's what I want to do: In my vBulletin installation, I have a forum (id=31) that is acting as a Classified Ad "category". This category contains (at the moment) four forums (ids = 33, 34, 38 & 39) that contain different types of classified ads. Replies are not permitted in these forums, so every thread contains only one post -- that of the thread starter. (Occasionally one of the moderators will reply to a classified ad, but it's rare.) I would like to modify the threadbit template used by forumdisplay.php in any of these classified ad forums -- but leave the rest of the forums alone. No changes there. The change I wish to make is to add a small column between the "Thread/Thread Starter" column, and the "Last Post" column. I would like this new column to contain the contents of "field9" from the thread starter's user profile. (This is a custom user profile field containing the two-letter State/Province abbreviation of the user.) I would like the HEADING on this column to be "State". Can anyone give me guidance in both formulating and placing the proper conditional & query to make this happen? Talk to me like I'm a two year-old, please, because as I said, I'm in way over my head here. Thanks, Bill |
#2
|
|||
|
|||
The problem with doing that is the information shown on the threadbit area is pulled from the thread table. No user information is pulled except for what is stored in the thread table, custom profile feilds are not included in this.
You are going to have to hack your board to achive the result you are looking for, you should try posting a request at www.vbulletin.org |
#3
|
|||
|
|||
Quote:
1) Hack newthread.php so that it writes "field9" from the user profile to the thread table at the time each new thread is created, or 2) hack forumdisplay.php to do a table JOIN in order to retrieve the desired information when the forum is viewed. Am I correct in that assessment? If so, is one way any better than the other? I'm thinking #1 is probably wiser, since the WRITE is happening anyway. (What's one more field?) Besides, each thread is created only once, but viewed many times. Seems like a better investment of server MIPs to write the data to the threads table & be done with it. Am I on track? Bill |
#4
|
|||
|
|||
Yes number 1 would be the better option at least imo, it would not add as much overhead as that JOIN would each page view.
|
#5
|
|||
|
|||
Quote:
I've created a new column in the 'thread' table. And I've tweaked /includes/functions_newpost.php just a tiny little bit, so that 'field9' from the user profile is written to the 'thread' table every time a new thread is created. See: https://vborg.vbsupport.ru/showthread.php?t=62507 if you're interested in the particulars. Which brings me back to my initial question. I would now like to modify the 'threadbit' template in the following ways: 1) Since ALL threads in these Classified Ad forums have ZERO replies, I think I can do without this column on my forumdisplay.php output. 2) I would like to ADD a small column -- to the right of "Thread/ Thread Starter", and to the left of "Last Post" -- to display the contents of this new 'field9' column in my 'thread' table. (Maybe just MOVE the 'replies' column?) 3) I would like these changes to impact ONLY the specified Classified Ad forums. Ideally, I would like the conditional to check for the "category" or parent forum if possible -- so that any new sub-forums I create would also be affected without re-hacking. But if that's not possible, I can specify the individual forum IDs manually. If I make the new colum the same width as the old "replies" column that I'm removing, it won't muck up the rest of the design too terribly much. Any guidance for a first-timer re: adding this sort of conditional to the threadbit template? Regards, Bill |
#6
|
|||
|
|||
Add this to the phpinclude_start template on a new line:
PHP Code:
PHP Code:
Then in the template FORUMDISPLAY find: HTML Code:
<td class="thead" align="center" nowrap="nowrap"><a href="$sorturl&order=desc&sort=replycount">$vbphrase[replies]</a> $sortarrow[replycount]</td> HTML Code:
<if condition="is_custom_forum($thread[forumid])"> <td class="alt1" align="center">$thread[field6]</td> <else /> <td class="alt1" align="center"><a href="#" onclick="who($thread[threadid])">$thread[replycount]</a></td> </if> HTML Code:
<td class="alt1" align="center"><a href="#" onclick="who($thread[threadid])">$thread[replycount]</a></td> HTML Code:
<if condition="is_custom_forum($thread[forumid])"> <td class="alt1" align="center">$thread[field6]</td> <else /> <td class="alt1" align="center"><a href="#" onclick="who($thread[threadid])">$thread[replycount]</a></td> </if> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|