PDA

View Full Version : Mini Mods - Forum Jump In Navbar


P1erce
07-03-2007, 10:00 PM
Okay a few notes first.

A. I wont support this software
B. I dont plan to improve it unless I have a requirement to do so personally for www.minimins.com
C. If you want to modify it, change it, make it something like DigitalPoint.com drop down, and charge for the modification be my guest, ill even pay for it :)
D. Thanks to the original idea at http://forums.digitalpoint.com
E. I dont know how to make a plugin so dont say anything about it not being a plugin.
F. It wont work as guest on my forum for SEO reasons. But please dont register on my forum just to see it in action, the screenshot says it all.
G. Dont complaine about my code, it works, but I accept it may not be the best way to do this.
H. Its the code for the Forum Jump menu, so its dynamic. If you have admin forums thoes who can see thoes forums will be able to see it in the jump menu, thoes who dont, wont simple :)

So, right, theres various other attempts at making this dropdown but to be honest they were not adequait. As such I spent 4/5 hours making my own one from the Forum Jump menu function.

The code!

1. Plugin Mangager
2. Add New Plugin

hook location : global
name : whatever, i called it "navbar jump menu"

This is the code:


//copyright MiniMins.com
function construct_jump2($parentid = -1, $addbox = true, $prependchars = '', $permission = '')
{
global $vbulletin, $optionselected, $usecategories, $jumpforumid, $jumpforumtitle, $jumpforumbits, $curforumid, $daysprune, $jumpforumbits2;
global $stylevar, $vbphrase, $defaultselected, $forumjump, $selectedone;
global $frmjmpsel; // allows context sensitivity for non-forum areas
global $gobutton;
static $complete = false;


if ($complete OR !$vbulletin->options['useforumjump'] OR !($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']))
{
return;
}

if (empty($vbulletin->iforumcache))
{
// get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump
cache_ordered_forums(0, 1);
}
if (empty($vbulletin->iforumcache["$parentid"]) OR !is_array($vbulletin->iforumcache["$parentid"]))
{
return;
}

foreach($vbulletin->iforumcache["$parentid"] AS $forumid)
{
$forumperms = $vbulletin->userinfo['forumpermissions']["$forumid"];
#if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums']) OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['showonforumjump']) OR !$vbulletin->forumcache["$forumid"]['displayorder'] OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['active']))
if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($vbulletin->forumcache["$forumid"]['showprivate'] == 1 OR (!$vbulletin->forumcache["$forumid"]['showprivate'] AND !$vbulletin->options['showprivateforums']))) OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['showonforumjump']) OR !$vbulletin->forumcache["$forumid"]['displayorder'] OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
continue;
}
else
{
// set $forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["$forumid"];

$optionvalue = $forumid;
$optiontitle = $prependchars . " $forum[title_clean]";

$optionclass = 'fjdpth' . iif($forum['depth'] > 4, 4, $forum['depth']);

if ($curforumid == $optionvalue)
{
$optionselected = 'selected="selected"';
$optionclass = 'fjsel';
$selectedone = 1;
}
else
{
$optionselected = '';
}

//eval('$jumpforumbits2 .= "' . fetch_template('option') . '";');
//$jumpforumbits2 .=
$jumpforumbits2[$optionvalue] .= "<a href=\"forumdisplay.php?f=".$forumid."\">".$optiontitle."</a>";
construct_jump2($optionvalue, 0, $prependchars . FORUM_PREPEND, $forumperms);


} // if can view
} // end foreach ($vbulletin->iforumcache[$parentid] AS $forumid)

}

function jumpforumbits2html()
{
global $jumpforumbits2;

$forumNavJumpMenu = "<div class=\"vbmenu_popup\" id=\"navbar_forumjump_menu\" style=\"display:none; position:absolute; padding: 0px;\">\n";
$forumNavJumpMenu .= "\t<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\">\n";
$forumNavJumpMenu .= "\t\t<tr><td class=\"tcat\" colspan=\"6\" style=\"padding: 4px\">Forums</td></tr>\n";
$forumNavJumpMenu .= "\t\t<tr class=\"fjump\">\n";
$forumNavJumpMenu .= "\t\t\t<td valign=\"top\">\n";

$start = true;

foreach($jumpforumbits2 AS $bit)
{
$canArray = explode("&nbsp;",$bit);
if($canArray[1] != " ")
{
//this is the table heading!
//end previous table
if(!$start)
{
//uncomment if you want multiple columns
//$forumNavJumpMenu .= "\t\t\t\t</table>\n";
//$forumNavJumpMenu .= "\t\t\t</td>\n";
//$forumNavJumpMenu .= "\t\t\t<td valign=\"top\">\n";
}
//start table - uncomment the next 2 lines if you want.. multiple columns rather than 1 solid column
//$forumNavJumpMenu .= "\t\t\t\t<table cellpadding=\"2\" style=\"border-bottom:1px solid #fff; border-collapse: collapse; padding:1px;\">\n";
//$forumNavJumpMenu .= "\t\t\t\t<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\">";
//start header
$forumNavJumpMenu .= "\t\t\t\t\t<tr><td class=\"thead\">".$bit."</td></tr>\n";
}
else
{
//just a normal heading
$forumNavJumpMenu .= "\t\t\t\t\t<tr><td class=\"vbmenu_option\">".$bit."</td></tr>\n";

}

$start = false;
}

//end tables
$forumNavJumpMenu .= "\t\t\t\t</table>\n";
$forumNavJumpMenu .= "\t\t\t</td>\n";
$forumNavJumpMenu .= "\t\t</tr>\n";
$forumNavJumpMenu .= "\t</table>\n";
$forumNavJumpMenu .= "</div>";

return $forumNavJumpMenu;

}
$forumNavJumpList = construct_jump2();

$forumNavJumpMenu= jumpforumbits2html();

Now, heres the code for the navbar, place it where you want the dropdown.

<td id="navbar_forumjump" class="vbmenu_control"><a href="$show[nojs_link]#forumjump" accesskey="j">Forum Jump</a> <script type="text/javascript"> vbmenu_register("navbar_forumjump"); </script></td>

And place this before <!-- / PAGENAV POPUP -->


<!-- Forum Jump -->
$forumNavJumpMenu
<!-- /ForumJump -->

So you can format the HTML to change the format from single column to multi column. Just uncomment the lines required. (see the comments in the source). I used a single column because I have too many sub forums and I didnt want to negoicate on the size of the text and it was going off the screen, so a single column was better suited to my needs.

If you have any general questions about the code Ill try and help. But the one part and dont ask me, is the recursvie function in construct_jump2 I barely understand it myself.

Enjoy :)

P1erce
07-04-2007, 04:37 PM
In tradition i reserve the first post :)

Kaleem
07-04-2007, 05:43 PM
How is it different from this ?
https://vborg.vbsupport.ru/showthread.php?t=133277

P1erce
07-04-2007, 05:48 PM
see the last box of code on that post?

You have to manually define every forum url and forum name. The one above fully automatic/dynamic content.

For me, with 100 forums, that was just totaly impractical. I did start and got through 20 forums and just got sick of it. Because I knew I would be moving forums around, renaming etc, so this semi-mod was created :)

Pierce

Magnumutz
07-04-2007, 06:00 PM
Heh... very nice. Good job !!
*Clicks install*

Later edit: Damn... my skin is too modified to use it :|
Hope i can modify it some way.

projectego
07-04-2007, 06:10 PM
Awesome! Thank you very much! :D

SkyCatcher
07-04-2007, 06:51 PM
I took a look at it and made you a nice little product file. The code is unchanged from what you've posted. Users still need to make the 2 template edits.

I played with this for about an hour coming up with a simple if($i = 6) {$pagenavthingy .="<br />";} but it doesn't work that way :/

The way the HTML is coded, it will count the categories and forums as the same thing so:

Lobby (Category)
Forum1
Forum2

That would be 3 loops instead of 1 :(

Which means it needs an extra check... if act as forum = 0 then counter+1.. then when counter = 6, throw in a <br /> and reset to 0. Then clean up the html code and you should be on your way if you care to make it resemble the other site.


Edit: Good lord my spelling is off!

P1erce
07-04-2007, 06:54 PM
I took a look at it and made you a nice little product file. The code is unchanged from what you've posted. Users still need to make the 2 template edits.

I played with this for about an hour coming up with a simple if($i = 6) {$pagenavthingy .="<br />";} but it doesn't work that way :/

The way the HTML is coded, it will count the categories and forums as the same thing so:

Lobby (Category)
Forum1
Forum2

That would be 3 loops instead of 1 :(

Which means it needs an extra check... if act as forum = 0 then counter+1.. then when counter = 1, throw in a <br /> and reset to 0. Then clean up the html code and you should be on your way if you care to make it resemble the other site.


Edit: Good lord my spelling is off!

Thanks!!

bhen13
07-04-2007, 07:06 PM
does it work with 3.6.5.?

SkyCatcher
07-04-2007, 07:08 PM
does it work with 3.6.5.?

Tested with 3.6.7PL1 here so yeah, should work with 3.5.x and 3.6.x

Magnumutz
07-04-2007, 09:22 PM
It doesn't show up my forums:

P1erce
07-04-2007, 09:45 PM
Show me the code for the drop down menu, and the <!-- forum jump --> stuff, in the rendered HTML

bhen13
07-04-2007, 10:05 PM
Great, it worked :) Installed !

Amman-DJ.CoM
07-04-2007, 10:50 PM
Installed , Thanks Dude

Magnumutz
07-05-2007, 03:05 AM
Show me the code for the drop down menu, and the <!-- forum jump --> stuff, in the rendered HTML
The Navbar template hasn't been modified in any way except this... i might be missing something, and i haven't changed the plugin's code in any way.

Total666
07-05-2007, 04:59 AM
WOW - Great job dude :) Thanks ...

Hornstar
07-05-2007, 04:59 AM
Hey this is really cool, hopefully it will pick up the other forums which have been split on other pages by amy's split forum home hack.

P1erce
07-05-2007, 09:27 AM
I think I might know whats wrong.

I notice your template doesnt have a "Jump Forum" drop down. What I noticed is that on my forum forum jump is disabled to guests and I get exactly that. And as the code is baised exactly on the forum jump menu, I would suspect thats it.

(I just disabled forum jump and I got the same results)

Go to.. Vbulletin Options -> General Settings -> Use Forum Jump Menu -> Yes -> Save

That should solve your issue.

Pierce

Magnumutz
07-05-2007, 10:52 AM
Yup, that was it... Thanks man.

P1erce
07-05-2007, 10:56 AM
Yup, that was it... Thanks man.

No Problem :cool:

voter
07-30-2007, 02:34 PM
I took a look at it and made you a nice little product file. The code is unchanged from what you've posted. Users still need to make the 2 template edits.

I played with this for about an hour coming up with a simple if($i = 6) {$pagenavthingy .="<br />";} but it doesn't work that way :/

The way the HTML is coded, it will count the categories and forums as the same thing so:

Lobby (Category)
Forum1
Forum2

That would be 3 loops instead of 1 :(

Which means it needs an extra check... if act as forum = 0 then counter+1.. then when counter = 6, throw in a <br /> and reset to 0. Then clean up the html code and you should be on your way if you care to make it resemble the other site.


Edit: Good lord my spelling is off!
Thanks for product xml.

voter
07-30-2007, 03:30 PM
Anybody idea - how to make the multicolumn version fluid - such that it not extend the width of used style? Or at least limit the number of columns to 4 at each row.
At forum.viparmenia.com/vb (http://forum.viparmenia.com/vb) it is terrible, when table extended the width and one need horizontal scrolling

voter
07-30-2007, 03:51 PM
To make it compatible with vbadvanced find in plugin code( AdminCP-> Plugins & Products -> Plugin Manager -> ForumJump (if you used productxml from SkyCatcher or the name you give to plugin) $jumpforumbits2[$optionvalue] .= "<a href=\"forumdisplay.php?f=".$forumid."\">".$optiontitle."</a>"; and put {$vbulletin->options['bburl']}/ before forumdisplay.php $jumpforumbits2[$optionvalue] .= "<a href=\"{$vbulletin->options['bburl']}/forumdisplay.php?f=".$forumid."\">".$optiontitle."</a>";

Ratman2050
08-07-2007, 05:01 PM
I'm not that good at coding, where exactly do I put the code in the navbar template if I want it right before the User CP??

P1erce
08-07-2007, 06:06 PM
Anybody idea - how to make the multicolumn version fluid - such that it not extend the width of used style? Or at least limit the number of columns to 4 at each row.
At forum.viparmenia.com/vb (http://forum.viparmenia.com/vb) it is terrible, when table extended the width and one need horizontal scrolling

I looked into it, but it drove me nuts, so i was happy with a single column.

Pierce

voter
08-08-2007, 07:59 AM
I looked into it, but it drove me nuts, so i was happy with a single column.

Pierce
Sure single column looks better.
But it would be nice to have multicolums version such that one can limt the colums say 4 and then next 4 starts from a new row.

The php script must put <tr> somehow checking by "if" do one reach the wished number of colums or better do one reach the WIDTH of window, to escape appearance of horizontal scrolling.

Multicolum and multirow -

raiderlax
08-08-2007, 08:11 AM
Sure single column looks better.
But it would be nice to have multicolums version such that one can limt the colums say 4 and then next 4 starts from a new row.

The php script must put <tr> somehow checking by "if" do one reach the wished number of colums or better do one reach the WIDTH of window, to escape appearance of horizontal scrolling.

Multicolum and multirow -

Second that :)

P1erce
08-08-2007, 02:24 PM
It wouldnt be that hard.

Just add a counter outside the foreach,

and then an if statment, if($counter == 4)

before the two lines that append the bottom of a table, if its 4, you want end of table, else you want to end the column.

I am not going to add it because I would have to test it, and as I said I am happy with the script and felt like sharing it :)

Pierce

yotsume
09-09-2007, 05:42 AM
A previous post that has instructions to get this to work with vbadvanced does not work for me. The menu will not pop open!

I got it to work with vBadvanced this way: In your vBa CMPS go to: Default Settings>Main Options >Portal Output Global Variables. In that box you must add: forumNavJumpMenu

Then the popup for the jump menu will work on your vBadvanced CMPS v3.0 RC1.

I am on vb3.6.4 and this works great now.

Then I noticed in my Links (vBadvanced Links Directory v2.0.1) the jump menu urls were wrong so I just hard coded the url to my forumdisplay.php in the product like this on line #75:

$jumpforumbits2[$optionvalue] .= "<a href=\"http://www.your.domain.com/forum/forumdisplay.php?f=".$forumid."\">".$optiontitle."</a>";

Just replace: http://www.your.domain.com/forum/ with your correct path.

All fixed!

Hornstar
11-07-2008, 08:42 PM
would be great to have this working the best it could possibly be for when vb 3.8 goes gold. and to have it also have multiple columns would be ideal. Anyone?

P1erce
12-28-2011, 07:14 PM
I used this mod, still do, but I do not need it for VB4 yet..

I have marked the code as reusable.

Pierce