Let us know what you think ...
Replace the makeforumjump section in global.php with this
hold your breath and pray ! (it joins 2 sql queries into one - we've got it running on forums.gameplay.com ;-) )
also downloadable from http://forums.gameplay.com/global_hack_pt1.html
(err yes there is at least another one on it's way ...)
fodder
// ###################### Start makeforumjump #######################
function makeforumjump ()
{
// this generates the jump to box
global $DB_site, $forumid, $optionselected, $usecategories, $jumpforumid, $jumpforumtitle, $jumpforumbits, $curforumid;
global $hideprivateforums, $defaultselected, $forumjump, $bbuserid, $bbusergroupid;
if ($forumid != "")
{
$curforumid = $forumid;
}
else
{
if ($threadid != "")
{
$getforumid = $DB_site->query_first ("SELECT forumid FROM thread WHERE threadid=$threadid");
$curforumid = $getforumid["forumid"];
}
}
$categorys = $DB_site->query ("SELECT category.categoryid, category.title as ctitle, category.displayorder , forum.forumid, forum.title as ftitle, forum.displayorder FROM category,forum WHERE forum.categoryid=category.categoryid AND forum.displayorder <>0 and category.displayorder<>0 and forum.active=1 order by category.displayorder, forum.displayorder");
$this_cat=0;
$old_categoryid=0;
$old_ctitle="";
while ($category = $DB_site->fetch_array ($categorys))
{
$forum=$category;
if ( $this_cat != $category["categoryid"] )
{
if ($this_cat >0)
{
if ($usecategories == 1 and $forumshown == 1)
{
$jumpforumid = "";
$jumpforumtitle = "";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
if ($curforumid == "cat$old_categoryid")
{
$optionselected = "selected";
} $jumpforumid = "cat$old_categoryid";
$jumpforumtitle = "Category: $old_ctitle";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
$optionselected = "";
$jumpforumid = "";
$jumpforumtitle = "--------------------";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
}
// add forum bits
$jumpforumbits.= $tempjumpforumbits;
}
$optionselected = "";
$forumshown = 0;
$tempjumpforumbits = "";
$this_cat = $category["categoryid"];
$old_categoryid = $this_cat;
$old_ctitle=$category["ctitle"];
}
if ($hideprivateforums == 1)
{
$getperms = getpermissions ($bbuserid, $bbusergroupid, $forum["forumid"]);
}
else
{
$getperms["canview"] = 1;
}
if ($getperms["canview"] == 1)
{
$forumshown = 1;
$jumpforumid = $forum["forumid"];
$jumpforumtitle = " " . $forum["ftitle"];
else
{
$optionselected = "";
}
eval ("\$tempjumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
} // end if $getperms...
}
if ($usecategories == 1 and $forumshown == 1)
{
$jumpforumid = "";
$jumpforumtitle = "";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
//if ($curforumid == "cat".$category["categoryid"])
if ($curforumid == "cat$old_categoryid")
{
$optionselected = "selected";
}
// $jumpforumid = "cat" . $category["categoryid"];
$jumpforumid = "cat$old_categoryid";
// $jumpforumtitle = "Category: " . $category["ctitle"];
$jumpforumtitle = "Category: $old_ctitle";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
$optionselected = "";
$jumpforumid = "";
$jumpforumtitle = "--------------------";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
}
// add forum bits
$jumpforumbits.= $tempjumpforumbits;
if ($selectedone != 1)
{
$defaultselected = "selected";
}
eval ("\$forumjump = \"".gettemplate ("forumjump")."\";");
}
if ($curforumid == $jumpforumid)
{
$optionselected = "selected";
$selectedone = 1;
}
There are a couple errors in your code involving extra and missing brackets so I wonder how you are running it. Here is a "fixed" version as in it seems to work
// ###################### Start makeforumjump #######################
function makeforumjump ()
{
// this generates the jump to box
global $DB_site, $forumid, $optionselected, $usecategories, $jumpforumid, $jumpforumtitle, $jumpforumbits, $curforumid;
global $hideprivateforums, $defaultselected, $forumjump, $bbuserid, $bbusergroupid;
if ($forumid != "")
{ $curforumid = $forumid; }
else
{ if ($threadid != "")
{
$getforumid = $DB_site->query_first ("SELECT forumid FROM thread WHERE threadid=$threadid");
$curforumid = $getforumid["forumid"];
}
}
$categorys = $DB_site->query ("SELECT category.categoryid, category.title as ctitle, category.displayorder , forum.forumid, forum.title as ftitle, forum.displayorder FROM category,forum WHERE forum.categoryid=category.categoryid AND forum.displayorder <>0 and category.displayorder<>0 and forum.active=1 order by category.displayorder, forum.displayorder");
$this_cat=0;
$old_categoryid=0;
$old_ctitle="";
while ($category = $DB_site->fetch_array ($categorys))
{
$forum=$category;
if ( $this_cat != $category["categoryid"] )
{
if ($this_cat >0)
{
if ($usecategories == 1 and $forumshown == 1)
{
$jumpforumid = "";
$jumpforumtitle = "";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
if ($curforumid == "cat$old_categoryid")
{ $optionselected = "selected"; }
$jumpforumid = "cat$old_categoryid";
$jumpforumtitle = "Category: $old_ctitle";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
$optionselected = "";
$jumpforumid = "";
$jumpforumtitle = "--------------------";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
}
// add forum bits
$jumpforumbits.= $tempjumpforumbits;
}
$optionselected = "";
$forumshown = 0;
$tempjumpforumbits = "";
$this_cat = $category["categoryid"];
$old_categoryid = $this_cat;
$old_ctitle=$category["ctitle"];
}
if ($hideprivateforums == 1)
{ $getperms = getpermissions ($bbuserid, $bbusergroupid, $forum["forumid"]); }
else
{ $getperms["canview"] = 1; }
if ($getperms["canview"] == 1)
{
$forumshown = 1;
$jumpforumid = $forum["forumid"];
$jumpforumtitle = " " . $forum["ftitle"];
}
else
{ $optionselected = ""; }
eval ("\$tempjumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
} // end if $getperms...
if ($usecategories == 1 and $forumshown == 1)
{
$jumpforumid = "";
$jumpforumtitle = "";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
//if ($curforumid == "cat".$category["categoryid"])
if ($curforumid == "cat$old_categoryid")
{ $optionselected = "selected"; }
// $jumpforumid = "cat" . $category["categoryid"];
$jumpforumid = "cat$old_categoryid";
// $jumpforumtitle = "Category: " . $category["ctitle"];
$jumpforumtitle = "Category: $old_ctitle";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
$optionselected = "";
$jumpforumid = "";
$jumpforumtitle = "--------------------";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
}
// add forum bits
$jumpforumbits.= $tempjumpforumbits;
if ($selectedone != 1)
{ $defaultselected = "selected"; }
eval ("\$forumjump = \"".gettemplate ("forumjump")."\";");
if ($curforumid == $jumpforumid)
{
$optionselected = "selected";
$selectedone = 1;
}
}
Here is mysql dump for my DB
Please tell me what you think?
How do I make the changes in phpMyAdmin to your indexes?
# MySQL dump 6.0
#
# Host: localhost Database: pbcforums2
#--------------------------------------------------------
# Server version 3.23.22-beta
#
# Table structure for table 'announcement'
#
CREATE TABLE announcement (
announcementid smallint(5) unsigned NOT NULL auto_increment,
title varchar(50) DEFAULT '' NOT NULL,
userid smallint(5) unsigned DEFAULT '0' NOT NULL,
startdate int(10) unsigned DEFAULT '0' NOT NULL,
enddate int(10) unsigned DEFAULT '0' NOT NULL,
pagetext mediumtext DEFAULT '' NOT NULL,
forumid smallint(6) DEFAULT '0' NOT NULL,
PRIMARY KEY (announcementid)
);
#
# Table structure for table 'bbcode'
#
CREATE TABLE bbcode (
bbcodeid smallint(5) unsigned NOT NULL auto_increment,
findcode text DEFAULT '' NOT NULL,
replacecode text DEFAULT '' NOT NULL,
PRIMARY KEY (bbcodeid)
);
#
# Table structure for table 'category'
#
CREATE TABLE category (
categoryid smallint(5) unsigned NOT NULL auto_increment,
title char(100) DEFAULT '' NOT NULL,
displayorder smallint(6) DEFAULT '0' NOT NULL,
PRIMARY KEY (categoryid)
);
#
# Table structure for table 'custom_avatar'
#
CREATE TABLE custom_avatar (
id int(6) NOT NULL auto_increment,
bin_data longblob DEFAULT '' NOT NULL,
filename varchar(50) DEFAULT '' NOT NULL,
filesize varchar(50) DEFAULT '' NOT NULL,
filetype varchar(50) DEFAULT '' NOT NULL,
userid int(10) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
UNIQUE userid (userid)
);
#
# Table structure for table 'forum'
#
CREATE TABLE forum (
forumid smallint(5) unsigned NOT NULL auto_increment,
title char(100) DEFAULT '' NOT NULL,
description char(250) DEFAULT '' NOT NULL,
active smallint(6) DEFAULT '0' NOT NULL,
displayorder smallint(6) DEFAULT '0' NOT NULL,
replycount int(10) unsigned DEFAULT '0' NOT NULL,
lastpost int(11) DEFAULT '0' NOT NULL,
lastposter char(50) DEFAULT '' NOT NULL,
threadcount mediumint(8) unsigned DEFAULT '0' NOT NULL,
categoryid smallint(5) unsigned DEFAULT '0' NOT NULL,
allowposting smallint(6) DEFAULT '0' NOT NULL,
daysprune smallint(5) unsigned DEFAULT '0' NOT NULL,
forumtemplate char(100) DEFAULT '' NOT NULL,
headertemplate char(100) DEFAULT '' NOT NULL,
useadvheader smallint(6) DEFAULT '0' NOT NULL,
footertemplate char(100) DEFAULT '' NOT NULL,
useadvfooter smallint(6) DEFAULT '0' NOT NULL,
forumbittemplate char(100) DEFAULT '' NOT NULL,
threadtemplate char(100) DEFAULT '' NOT NULL,
threadbittemplate char(100) DEFAULT '' NOT NULL,
replytemplate char(100) DEFAULT '' NOT NULL,
newthreadtemplate char(100) DEFAULT '' NOT NULL,
edittemplate char(100) DEFAULT '' NOT NULL,
rulestemplate char(100) DEFAULT '' NOT NULL,
titleimage char(100) DEFAULT '' NOT NULL,
replyimage char(100) DEFAULT '' NOT NULL,
newthreadimage char(100) DEFAULT '' NOT NULL,
closedthreadimage char(100) DEFAULT '' NOT NULL,
newpostemail char(250) DEFAULT '' NOT NULL,
newthreademail char(250) DEFAULT '' NOT NULL,
moderatenew smallint(6) DEFAULT '0' NOT NULL,
allowbbcode smallint(6) DEFAULT '0' NOT NULL,
allowimages smallint(6) DEFAULT '0' NOT NULL,
allowhtml smallint(6) DEFAULT '0' NOT NULL,
allowsmilies smallint(6) DEFAULT '0' NOT NULL,
PRIMARY KEY (forumid),
KEY displayorder (displayorder)
);
#
# Table structure for table 'forumpermission'
#
CREATE TABLE forumpermission (
forumpermissionid smallint(5) unsigned NOT NULL auto_increment,
forumid smallint(5) unsigned DEFAULT '0' NOT NULL,
usergroupid smallint(5) unsigned DEFAULT '0' NOT NULL,
canview smallint(6) DEFAULT '0' NOT NULL,
cansearch smallint(6) DEFAULT '0' NOT NULL,
canemail smallint(6) DEFAULT '0' NOT NULL,
canpostnew smallint(6) DEFAULT '0' NOT NULL,
canreply smallint(6) DEFAULT '0' NOT NULL,
canadminedit smallint(6) DEFAULT '0' NOT NULL,
canedit smallint(6) DEFAULT '0' NOT NULL,
candelete smallint(6) DEFAULT '0' NOT NULL,
canopenclose smallint(6) DEFAULT '0' NOT NULL,
canmove smallint(6) DEFAULT '0' NOT NULL,
PRIMARY KEY (forumpermissionid),
KEY forumid (forumid)
);
#
# Table structure for table 'icon'
#
CREATE TABLE icon (
iconid smallint(5) unsigned NOT NULL auto_increment,
title char(100) DEFAULT '' NOT NULL,
iconpath char(100) DEFAULT '' NOT NULL,
PRIMARY KEY (iconid)
);
#
# Table structure for table 'pmstats'
#
CREATE TABLE pmstats (
id mediumint(8) unsigned NOT NULL auto_increment,
toid smallint(5) unsigned DEFAULT '0' NOT NULL,
fromid smallint(5) unsigned DEFAULT '0' NOT NULL,
datetime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
PRIMARY KEY (id)
);
#
# Table structure for table 'poll'
#
CREATE TABLE poll (
pollid mediumint(8) unsigned NOT NULL auto_increment,
question varchar(100),
options text,
active smallint(6) DEFAULT '1',
PRIMARY KEY (pollid)
);
#
# Table structure for table 'pollvote'
#
CREATE TABLE pollvote (
pollvoteid mediumint(8) unsigned NOT NULL auto_increment,
pollid mediumint(8) unsigned,
userid int(10) unsigned DEFAULT '0',
votedate int(11) unsigned,
voteoption int(2) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (pollvoteid)
);
#
# Table structure for table 'post'
#
CREATE TABLE post (
postid int(10) unsigned NOT NULL auto_increment,
threadid int(10) unsigned DEFAULT '0' NOT NULL,
username varchar(50) DEFAULT '' NOT NULL,
userid int(10) unsigned DEFAULT '0' NOT NULL,
title varchar(100) DEFAULT '' NOT NULL,
dateline int(11) DEFAULT '0' NOT NULL,
pagetext mediumtext,
allowsmilie smallint(6) DEFAULT '0' NOT NULL,
email smallint(6) DEFAULT '0' NOT NULL,
signature smallint(6) DEFAULT '0' NOT NULL,
ipaddress varchar(16) DEFAULT '' NOT NULL,
iconid smallint(5) unsigned DEFAULT '0' NOT NULL,
visible smallint(6) DEFAULT '0' NOT NULL,
pollid mediumint(8) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (postid),
KEY threadid (threadid),
KEY username (username),
KEY userid (userid),
KEY dateline (dateline)
);
#
# Table structure for table 'privatercvd'
#
CREATE TABLE privatercvd (
msgid mediumint(8) unsigned NOT NULL auto_increment,
toid smallint(5) unsigned DEFAULT '0' NOT NULL,
fromid smallint(5) unsigned DEFAULT '0' NOT NULL,
title varchar(100) DEFAULT '' NOT NULL,
text mediumtext DEFAULT '' NOT NULL,
datetime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
signature tinyint(4) DEFAULT '0' NOT NULL,
iconid smallint(5) DEFAULT '0' NOT NULL,
repliedto tinyint(4) DEFAULT '0' NOT NULL,
folder tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (msgid)
);
#
# Table structure for table 'privatesent'
#
CREATE TABLE privatesent (
msgid mediumint(8) unsigned NOT NULL auto_increment,
toid smallint(5) unsigned DEFAULT '0' NOT NULL,
fromid smallint(5) unsigned DEFAULT '0' NOT NULL,
title varchar(100) DEFAULT '' NOT NULL,
text mediumtext DEFAULT '' NOT NULL,
datetime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
signature tinyint(4) DEFAULT '0' NOT NULL,
iconid smallint(5) DEFAULT '0' NOT NULL,
PRIMARY KEY (msgid)
);
#
# Table structure for table 'replacement'
#
CREATE TABLE replacement (
replacementid smallint(5) unsigned NOT NULL auto_increment,
findword text DEFAULT '' NOT NULL,
replaceword text DEFAULT '' NOT NULL,
PRIMARY KEY (replacementid)
);
#
# Table structure for table 'session'
#
CREATE TABLE session (
sessionid mediumint(8) unsigned NOT NULL auto_increment,
userid smallint(5) unsigned DEFAULT '0' NOT NULL,
ipaddress char(20) DEFAULT '' NOT NULL,
lastactivity int(10) unsigned DEFAULT '0' NOT NULL,
location char(250) DEFAULT '' NOT NULL,
PRIMARY KEY (sessionid),
KEY userid (userid),
KEY location (location)
);
#
# Table structure for table 'smilie'
#
CREATE TABLE smilie (
smilieid smallint(5) unsigned NOT NULL auto_increment,
title char(100) DEFAULT '' NOT NULL,
smilietext char(10) DEFAULT '' NOT NULL,
smiliepath char(100) DEFAULT '' NOT NULL,
PRIMARY KEY (smilieid)
);
#
# Table structure for table 'template'
#
CREATE TABLE template (
templateid smallint(5) unsigned NOT NULL auto_increment,
title varchar(100) DEFAULT '' NOT NULL,
template mediumtext DEFAULT '' NOT NULL,
PRIMARY KEY (templateid)
);
#
# Table structure for table 'thread'
#
CREATE TABLE thread (
threadid int(10) unsigned NOT NULL auto_increment,
title varchar(100) DEFAULT '' NOT NULL,
lastpost int(10) unsigned DEFAULT '0' NOT NULL,
forumid smallint(5) unsigned DEFAULT '0' NOT NULL,
open smallint(6) DEFAULT '0' NOT NULL,
replycount int(10) unsigned DEFAULT '0' NOT NULL,
postusername varchar(50) DEFAULT '' NOT NULL,
lastposter varchar(50) DEFAULT '' NOT NULL,
dateline int(10) unsigned DEFAULT '0' NOT NULL,
views smallint(5) unsigned DEFAULT '0' NOT NULL,
iconid smallint(5) unsigned DEFAULT '0' NOT NULL,
notes varchar(250) DEFAULT '' NOT NULL,
visible smallint(6) DEFAULT '0' NOT NULL,
subjectindex varchar(100) DEFAULT '' NOT NULL,
threadindex mediumtext DEFAULT '' NOT NULL,
userindex mediumtext DEFAULT '' NOT NULL,
PRIMARY KEY (threadid),
KEY lastpost (lastpost),
KEY forumid (forumid)
);
#
# Table structure for table 'user'
#
CREATE TABLE user (
userid int(10) unsigned NOT NULL auto_increment,
usergroupid smallint(5) unsigned DEFAULT '0' NOT NULL,
username varchar(50) DEFAULT '' NOT NULL,
password varchar(50) DEFAULT '' NOT NULL,
email varchar(50) DEFAULT '' NOT NULL,
parentemail varchar(50) DEFAULT '' NOT NULL,
coppauser smallint(6) DEFAULT '0' NOT NULL,
homepage varchar(100) DEFAULT '' NOT NULL,
icq varchar(20) DEFAULT '' NOT NULL,
aim varchar(20) DEFAULT '' NOT NULL,
yahoo varchar(20) DEFAULT '' NOT NULL,
signature mediumtext DEFAULT '' NOT NULL,
adminemail smallint(6) DEFAULT '0' NOT NULL,
showemail smallint(6) DEFAULT '0' NOT NULL,
invisible smallint(6) DEFAULT '0' NOT NULL,
usertitle varchar(250) DEFAULT '' NOT NULL,
customtitle smallint(6) DEFAULT '0' NOT NULL,
joindate int(10) unsigned DEFAULT '0' NOT NULL,
canpost smallint(6) DEFAULT '0' NOT NULL,
cookieuser smallint(6) DEFAULT '0' NOT NULL,
daysprune smallint(6) DEFAULT '0' NOT NULL,
lastvisit int(10) unsigned DEFAULT '0' NOT NULL,
lastactivity int(10) unsigned DEFAULT '0' NOT NULL,
lastpost int(10) unsigned DEFAULT '0' NOT NULL,
posts smallint(5) unsigned DEFAULT '0' NOT NULL,
timezoneoffset smallint(6) DEFAULT '0' NOT NULL,
emailnotification smallint(6) DEFAULT '0' NOT NULL,
iconpath varchar(254) DEFAULT '' NOT NULL,
usertext varchar(15) DEFAULT '' NOT NULL,
fav_gun varchar(100) DEFAULT '' NOT NULL,
fav_paint varchar(100) DEFAULT '' NOT NULL,
fav_barrel varchar(100) DEFAULT '' NOT NULL,
fav_goggles varchar(100) DEFAULT '' NOT NULL,
team varchar(100) DEFAULT '' NOT NULL,
sponsers varchar(100) DEFAULT '' NOT NULL,
field varchar(100) DEFAULT '' NOT NULL,
fav_player varchar(100) DEFAULT '' NOT NULL,
fav_team varchar(100) DEFAULT '' NOT NULL,
advice mediumtext DEFAULT '' NOT NULL,
interests mediumtext DEFAULT '' NOT NULL,
occupation varchar(100) DEFAULT '' NOT NULL,
city varchar(150) DEFAULT '' NOT NULL,
state char(2) DEFAULT '' NOT NULL,
country varchar(150) DEFAULT '' NOT NULL,
ignorelist mediumtext DEFAULT '' NOT NULL,
pmfolders mediumtext DEFAULT '' NOT NULL,
receivepm tinyint(4) DEFAULT '1' NOT NULL,
emailonpm tinyint(4) DEFAULT '1' NOT NULL,
PRIMARY KEY (userid),
KEY usergroupid (usergroupid),
KEY username (username)
);
#
# Table structure for table 'usergroup'
#
CREATE TABLE usergroup (
usergroupid smallint(5) unsigned NOT NULL auto_increment,
title char(100) DEFAULT '' NOT NULL,
usertitle char(100) DEFAULT '' NOT NULL,
canview smallint(6) DEFAULT '0' NOT NULL,
cansearch smallint(6) DEFAULT '0' NOT NULL,
canemail smallint(6) DEFAULT '0' NOT NULL,
canpostnew smallint(6) DEFAULT '0' NOT NULL,
canreply smallint(6) DEFAULT '0' NOT NULL,
canadminedit smallint(6) DEFAULT '0' NOT NULL,
canedit smallint(6) DEFAULT '0' NOT NULL,
candelete smallint(6) DEFAULT '0' NOT NULL,
canopenclose smallint(6) DEFAULT '0' NOT NULL,
canmove smallint(6) DEFAULT '0' NOT NULL,
cancontrolpanel smallint(6) DEFAULT '0' NOT NULL,
canusepm tinyint(4) DEFAULT '1' NOT NULL,
canpostpoll smallint(6) DEFAULT '0' NOT NULL,
PRIMARY KEY (usergroupid)
);
#
# Table structure for table 'usertitle'
#
CREATE TABLE usertitle (
usertitleid smallint(5) unsigned NOT NULL auto_increment,
minposts smallint(5) unsigned DEFAULT '0' NOT NULL,
title char(250) DEFAULT '' NOT NULL,
PRIMARY KEY (usertitleid)
);
[Edited by VirtueTech on 09-07-2000 at 11:59 AM]
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.