View Full Version : Forum Links
JJR512
08-09-2002, 10:00 PM
This hack puts links to all forums a user has access to at the top of the page (or anywhere else you want it). I've been using hard-coded links on my own forums ever since my site opened over two years ago, and many people love them. For the record, the idea of having links to all forums at the top of the page is not my original idea; I originally saw it at Hardware Central (http://www.hardwarecentral.com/). This is also something I requested once, long ago, at vbulletin.com, and Tubedogg came up with something that worked fairly well. However, his version never had any permission-checking features, so links to all forums were displayed. My version, written from the ground up by myself, does check permissions.
Some assistance was also provided by FireFly, who showed me how to keep the separation character from appearing after the last link. Thanks, FireFly! :)
This hack is basically very simple. You just add a few lines of code to one file, and a variable to your header template to show the output. But you can take this and customize it greatly, by formatting how the output is displayed, by surrounding the variable with various tags to center it or control the font style and size, or you could make it into a table; it's all up to you.
For a simple example, look at http://testvb.jjr512.com All I've done there is put the variable at the top of the header template, inside smallfont and center tags. For a more elaborate example, take a look at http://www.jjr512.com I've built it into a table with a different background color and a thin line border with curved corners. It's also duplicated in the footer. How you do it on your site is up to you. The possibilities are endless. If you come up with something you feel is neat and unique, maybe you could share it with us to give others an idea or two. :)
Xenon
08-10-2002, 12:43 AM
neo is right, nice idea m8
im ganna use this in a drop down :), kinda like a forum jump on any page! :D, this is so useful. props on this on
JJR512
08-10-2002, 12:59 AM
If you're going to use it as a drop-down, like the forum jump, why not just use the forum jump instead? :)
(I don't use forumjump anywhere on my board because before we ever started using vBulletin, everyone was used to these links, which I had hard-coded back in our UBB days. So, basically, I see this as an alternative to the forumjump feature...an easier-to-use alternative, since it just takes one click, rather than opening up the drop-down, scrolling if needed, etc. But if you like both, good for you! :))
side menu to board ????
seems best place for it (cant you tell i want a side menu)
Erwin
08-10-2002, 01:17 AM
Nice idea. This would add a query to every page on the forum though. But it's a great way of listing out all forums on all pages. :)
Erwin
08-10-2002, 01:19 AM
Originally posted by Mr_P
side menu to board ????
seems best place for it (cant you tell i want a side menu)
It would be very easy to set up a side menu, by adding the appropriate < td> tags in your header. Then adding the correct < /td> tags in yourfooter.
It's just modifying the header and footer templates. :)
Destee
08-10-2002, 01:33 AM
Hey JJR512 ... thank you for this ... but it's displaying every forum in my cp ... including a long ago deleted one, that isn't in my cp. It's also displaying the forums that are marked with a zero, that I don't want displayed. I logged out to be sure it wasn't just showing them to my userid.
I only want the forums listed that are currently showing on the forum home page. Is it suppose to display more than that?
Destee
Boofo
08-10-2002, 01:41 AM
Exactly how and where would you add those tags to make it on the side?
Originally posted by Erwin
It would be very easy to set up a side menu, by adding the appropriate < td> tags in your header. Then adding the correct < /td> tags in yourfooter.
It's just modifying the header and footer templates. :)
JJR512
08-10-2002, 01:48 AM
Originally posted by Destee
Hey JJR512 ... thank you for this ... but it's displaying every forum in my cp ... including a long ago deleted one, that isn't in my cp. It's also displaying the forums that are marked with a zero, that I don't want displayed. I logged out to be sure it wasn't just showing them to my userid.
I only want the forums listed that are currently showing on the forum home page. Is it suppose to display more than that?
Destee
I don't see how it could display a forum that doesn't exist. If it doesn't show up in the admin cp, how can it exist? I don't understand how my hack can find a forum that vBulletin itself can't find. You may need to look into your forums table in your database and see if it's still there somehow, and remove it from there manually, but again, how this could be possible is beyond me.
And what do you mean by "forums marked with a zero"?
Destee
08-10-2002, 01:56 AM
Hi JJR512 ... I don't know how it is finding this deleted forum either, hmmmm ... makes me think I have additional issues ... but it is displaying one that I deleted long ago.
In regard to the forums marked with a zero, it's done in the cp, regarding the order that you want forums to be displayed. If you don't want it to be displayed, mark it with a zero and it won't show up on your forum home page. These were some forums created for our first "birthday celebration" and have outlived their usefulness ... I've just not deleted them.
By the way, both your hack and Overgrow's Spider Friendly hack displays the deleted forum and the ones marked with a zero ... it's just that his hack isn't on my forum home page ... so it's no biggie.
Destee
JJR512
08-10-2002, 02:08 AM
OK, I see what you mean about the zero thing now. Yes, there is no provision in my hack to ignore forums with a displayorder of 0. Actually, I had no idea that vBulletin wouldn't display forums like that, because it's never even occurred to me to try. When I want a forum to not show up anymore, I edit the forum properties and set "Is active?" to No. Incidentally, if you do this, the forum actually still is active, if someone gets into it manually with putting that forum's forumid number in a forumdisplay.php URL. But the forum does not show up at all on the message board or in the list generated by this hack. On my board, we call this a "hidden forum", and have one hidden forum in use. ;) So, if you want these forums to not show up in this list, just set the active status to no. Or, if you really insist, I could throw in some additional code to ignore a forum if its displayorder is 0.
Actually I could just tell you how to do it...In the first query, change
WHERE active='1'
To
WHERE active='1' AND displayorder>'0'
Now I haven't tested that, but that should work in theory. :) (Note: Unless this proves to be a common problem, I do not plan on putting this change into the official release.)
But I strongly suggest setting the active status to no; this will solve the problem not just with my hack, but also with the Spider Friendly hack, too!
Boofo
08-10-2002, 02:15 AM
This hack is a nice idea, JJR512, but there is no way I can keep it installed when I went from 37 queries on my home page to 125 queries after adding this hack. Your page was well over 100 queries when I looked at it. That would slow any board with any kind of activity to a crawl. Is there any way to reduce the queries to a more manageable size?
Erwin
08-10-2002, 02:20 AM
Originally posted by Boofo
Exactly how and where would you add those tags to make it on the side?
I posted instructions on how to add a left column side menu to every page in the Templates forum here. :)
https://vborg.vbsupport.ru/showthread.php?s=&threadid=42115
JJR512
08-10-2002, 02:23 AM
Wow! I had no idea it was that much. I can only assume that most are coming from the getpermissions routine. I don't know of any way to reduce the number of queries involved; I'm not that skilled yet. ;)
If anyone else can offer some advice, I'm sure we'd all appreciate it.
Boofo
08-10-2002, 02:36 AM
Yeah, it shocked me to no end. I was just getting used to 37 queries. :)
The more forums you have the query count would probably go up, right? Did you check the function out that Firefly posted on getting permissions from the db? That might help. :)
Also, it doesn't display in the same order my forums are listed. Any way to get that displaying in the same order?
Originally posted by JJR512
Wow! I had no idea it was that much. I can only assume that most are coming from the getpermissions routine. I don't know of any way to reduce the number of queries involved; I'm not that skilled yet. ;)
If anyone else can offer some advice, I'm sure we'd all appreciate it.
Boofo
08-10-2002, 02:39 AM
Thank you, sir, you are a gentleman and a scholar. :)
Originally posted by Erwin
I posted instructions on how to add a left column side menu to every page in the Templates forum here. :)
https://vborg.vbsupport.ru/showthread.php?s=&threadid=42115
JJR512
08-10-2002, 02:49 AM
Originally posted by Boofo
The more forums you have the query count would probably go up, right? Did you check the function out that Firefly posted on getting permissions from the db? That might help. :)
I don't know what you're talking about; can you give me a link to what FireFly posted?
Originally posted by Boofo
Also, it doesn't display in the same order my forums are listed. Any way to get that displaying in the same order?
The order of the links is based on the displayorder number you give each forum in the admin cp. However, the forums home page doesn't exactly list the forums in the same order, because the forums are grouped by category.
Say you have CategoryA, with a displayorder of 1. Then you have CategoryB, with a displayorder of 10. Then you have two forums, Forum1 with a displayorder of 2, and Forum2, with a displayorder of 3. If Forum2 is a subforum in CategoryA, on your forums home page, it will appear higher up that Forum1, even though it has a higher displayorder, because it's part of a category with a lower forumdisplay. I think that's probably a little confusing; I hope it makes sense.
What I did to get everything in the right order is this. For all categories, I gave them displayorders of 100, 200, 300, etc., in the order they should appear on the forums home page. Then for each main forum, I gave them a number like 110, 120, 130, etc., if the forum is in the first category (which has a displayorder of 100); for forums in the second category, they were numbered like 210, 220, etc., and so on, you get the idea. If any main forum has a subforum, say a forum with a displayorder of 110 has a subforum, the subforum displayorder is 111, and another would be 112, and so on. Make sense? If you renumber the displayorders of all your forums like this, they should show up on the board itself the same way they always have, but will also be in the correct order in the forumlinks.
Erwin
08-10-2002, 02:51 AM
Originally posted by Boofo
This hack is a nice idea, JJR512, but there is no way I can keep it installed when I went from 37 queries on my home page to 125 queries after adding this hack. Your page was well over 100 queries when I looked at it. That would slow any board with any kind of activity to a crawl. Is there any way to reduce the queries to a more manageable size?
The more forums you have, the more queries. And all these queries will be on EVERY page of your forum. So watch out! Have a look and see how forumjump does the query for forum permissions - forumjump only uses 1 extra query, no matter how many forums.
JJR512
08-10-2002, 02:58 AM
I wasn't too sure if what I described in my previous message was very clear, so I've attached an image of my admin cp/forums setup page, so you can see my displayorders.
JJR512
08-10-2002, 03:01 AM
Originally posted by Erwin
The more forums you have, the more queries. And all these queries will be on EVERY page of your forum. So watch out! Have a look and see how forumjump does the query for forum permissions - forumjump only uses 1 extra query, no matter how many forums.
Yes, the more forums, the more queries, but the scary thing is that it's not just one additional query per forum, because I don't have that many forums! I think the getperms is adding a few queries per each forum, meaning that the queries will grow bigger by greater amounts as you have more forums!
So, I will be closely examining the forumjump feature to see if I can learn anything from it. Until then, heavy-usage board owners may wish to not install it. Personally, I haven't noticed any difference, but I wouldn't exactly call my board very active...
Boofo
08-10-2002, 03:18 AM
No, you explained it perfectly. I was doing mine like 1 for the category and 1...2...3...4...5 for the forums on every one of them. I should have known better than to do it that way. DOH!!! :) Now everything is listed as it should be. Thanks for taking the time to explain it. :)
Here is a link to that function I told you about. The one Firefly wrote. Hope it helps. :)
https://vborg.vbsupport.ru/showthread.php?postid=281202#post281202
Originally posted by JJR512
I wasn't too sure if what I described in my previous message was very clear, so I've attached an image of my admin cp/forums setup page, so you can see my display-orders.
Destee
08-10-2002, 04:33 AM
Originally posted by JJR512
OK, I see what you mean about the zero thing now. Yes, there is no provision in my hack to ignore forums with a displayorder of 0. Actually, I had no idea that vBulletin wouldn't display forums like that, because it's never even occurred to me to try. When I want a forum to not show up anymore, I edit the forum properties and set "Is active?" to No. Incidentally, if you do this, the forum actually still is active, if someone gets into it manually with putting that forum's forumid number in a forumdisplay.php URL. But the forum does not show up at all on the message board or in the list generated by this hack. On my board, we call this a "hidden forum", and have one hidden forum in use. ;) So, if you want these forums to not show up in this list, just set the active status to no. Or, if you really insist, I could throw in some additional code to ignore a forum if its displayorder is 0.
Actually I could just tell you how to do it...In the first query, change
WHERE active='1'
To
WHERE active='1' AND displayorder>'0'
Now I haven't tested that, but that should work in theory. :) (Note: Unless this proves to be a common problem, I do not plan on putting this change into the official release.)
But I strongly suggest setting the active status to no; this will solve the problem not just with my hack, but also with the Spider Friendly hack, too!
Thanks JJR512 ... I took your advice and changed the status to no and that did work. Unfortunately, even doing this, I still have too many forums and/or their names are too long ... making the many lines sit unattractively at the top of my pages. Great hack though and thanks for taking the time to help me.
Destee
Velocd
08-10-2002, 04:45 AM
Awesome looking hack, I may just have to consider this ;)
edit:
whoops, saw the queries thing...is there a possible way around? Without having to use the forumjump-thingy?
Originally posted by JJR512
If you're going to use it as a drop-down, like the forum jump, why not just use the forum jump instead? :)
That way i can ait to my portal and all pages and take off the forum jump :). ill have this set in my header, kinda like overgrow.com
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.