The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Hotlinking Forum Names In Posts?
Hi everyone,
I know the basics about vB and have edited a few templates and code here and there, but nothing major. So, I was thinking the other day that if someone posted a thread (or reply) if within the text they reference a Forum, instead of manually having to make a hyperlink linking the text to the forum if somehow vB would auto-detect the name and hotlink it automatically. Here's a more visual explaination: original post: Code:
Please go to the FAQ and Clan Knowledge forum if you have any questions or need to find information about the clan. Code:
Please go to the FAQ and Clan Knowledge forum if you have any questions or need to find information about the clan. Any insight would be greatly appreciated! Thanks, Killerhands |
#2
|
|||
|
|||
Yeah, seems like you could do that without a lot of trouble. The forum names are already in memory (although it may depend on which php file is being executed, I'm not sure). You'd just need to find the right hooks to do a search and replace on the text. Would you want it to be before it's stored or just before it's displayed? I'd think before it's stored so that if a forum is renamed the link would still be there. Some one just asked about that recently, I think I found that the newpost_process hook is called before a post is stored in the database, but that doesn't work on posts being edited (the thread is https://vborg.vbsupport.ru/showthread.php?t=250140).
Maybe another way would be to replace the forum name with some bbcode like [forum]123[/forum], then define a bbcode to provide a link (although I guess you couldn't just define a bbcode using the manager, you'd have to write a plugin to be able to insert the forum's name). Hope some of this make sense. |
#3
|
|||
|
|||
The bbcode makes the most sense, just I think the hard part for me if figuring out how to extrapolate the forum ID based on the text. I just don't really know where to start. Would I have to make a query to the database asking for all the forum names listed within it and do a search from that?
|
#4
|
|||
|
|||
A while back I knew a lot about this because I was working on somethng that used the forum info, and now I've forgotten. Maybe the best thing is to look at forumdisplay.php (and also be prepared to look into any included files to see where stuff comes from, like init.php and global.php).
A lot of stuff gets cached to avoid doing a lot of database queries. For instance, the forum info gets used a lot, so once the query's been done the array is serialized and saved as a big string to avoid doing a complex query every time someone vists the home page. There's a $vbulletin->forumcache that's an array by forum id, and one of the fields is 'title', so $vbulletin->forumcache['12']['title'] should be the name of forum with id 12. There's also a variable called $foruminfo, I can't remember what that's for. You'll have to investigate to see under what circumstances these things are filled in (or maybe someone else can help). |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|