larryd
05-26-2002, 08:21 AM
Ive been toying around tonight with creating a new page called favorites.php that will allow me to display just the forums that Ive maked as the ones I want to suscribe to with a little bit of other basic information. Basically I reworked the usercp page, the only problem Im running into is that the forums are showing up in alphabetical format and thats not what i want, I want them to show up in the order they are displayed on the index.php file.. What do I have to change to do this? Here is the code for it
// ############################### start subscribed forums ###############################
$forums=$DB_site->query("SELECT * FROM forum,subscribeforum WHERE subscribeforum.forumid=forum.forumid AND userid=$bbuserinfo[userid] ORDER BY title");
$totalforums=$DB_site->num_rows($forums);
$forumbits = '';
if ($totalforums>0) {
while ($forum=$DB_site->fetch_array($forums)) {
$forumperms=getpermissions($forum[forumid]);
if (!$hideprivateforums) {
$forumperms[canview]=1;
}
if ($forumperms[canview]) {
$forumshown=1;
// do light bulb
if ($bbuserinfo[lastvisitdate]=="Never") {
$forum[onoff]="on";
} else {
if (isset($bbforumview[$forum['forumid']]) and $bbforumview[$forum['forumid']]>$bbuserinfo['lastvisit']) {
$userlastvisit=$bbforumview[$forum['forumid']];
} else {
$userlastvisit=$bbuserinfo['lastvisit'];
}
if ($userlastvisit<$forum['lastpost']) {
$forum[onoff]="on";
} else {
$forum[onoff]="off";
}
}
if ((!$forumperms['canpostnew'] and $showlocks) or $forum['allowposting']==0) {
$forum[onoff].="lock";
}
// prepare template vars
if (!$showforumdescription) {
$forum[description]="";
}
// dates
if ($forum[lastpost]>0) {
$forum[lastpostdate]=vbdate($dateformat,$forum[lastpost]);
$forum[lastposttime]=vbdate($timeformat,$forum[lastpost]);
eval("\$forum[lastpostinfo] = \"".gettemplate("forumhome_lastpostby")."\";");
} else {
$forum[lastpostinfo]="Never";
}
eval("\$forumbits .= \"".gettemplate("favorites_forumbit")."\";");
} // if can view
} // while forums
eval("\$forumlist = \"".gettemplate("usercp_forums")."\";");
} else {
eval("\$forumlist = \"".gettemplate("usercp_noforums")."\";");
}
if you want to see exactly what im talking about the page is located here
http://www.newcelica.org/forums/favorites.php?s=
Im still gonna change a few other things but the biggest thing I want to change is the display order of the forums from alphabetical to numercial.. thanks in advance guys..
// ############################### start subscribed forums ###############################
$forums=$DB_site->query("SELECT * FROM forum,subscribeforum WHERE subscribeforum.forumid=forum.forumid AND userid=$bbuserinfo[userid] ORDER BY title");
$totalforums=$DB_site->num_rows($forums);
$forumbits = '';
if ($totalforums>0) {
while ($forum=$DB_site->fetch_array($forums)) {
$forumperms=getpermissions($forum[forumid]);
if (!$hideprivateforums) {
$forumperms[canview]=1;
}
if ($forumperms[canview]) {
$forumshown=1;
// do light bulb
if ($bbuserinfo[lastvisitdate]=="Never") {
$forum[onoff]="on";
} else {
if (isset($bbforumview[$forum['forumid']]) and $bbforumview[$forum['forumid']]>$bbuserinfo['lastvisit']) {
$userlastvisit=$bbforumview[$forum['forumid']];
} else {
$userlastvisit=$bbuserinfo['lastvisit'];
}
if ($userlastvisit<$forum['lastpost']) {
$forum[onoff]="on";
} else {
$forum[onoff]="off";
}
}
if ((!$forumperms['canpostnew'] and $showlocks) or $forum['allowposting']==0) {
$forum[onoff].="lock";
}
// prepare template vars
if (!$showforumdescription) {
$forum[description]="";
}
// dates
if ($forum[lastpost]>0) {
$forum[lastpostdate]=vbdate($dateformat,$forum[lastpost]);
$forum[lastposttime]=vbdate($timeformat,$forum[lastpost]);
eval("\$forum[lastpostinfo] = \"".gettemplate("forumhome_lastpostby")."\";");
} else {
$forum[lastpostinfo]="Never";
}
eval("\$forumbits .= \"".gettemplate("favorites_forumbit")."\";");
} // if can view
} // while forums
eval("\$forumlist = \"".gettemplate("usercp_forums")."\";");
} else {
eval("\$forumlist = \"".gettemplate("usercp_noforums")."\";");
}
if you want to see exactly what im talking about the page is located here
http://www.newcelica.org/forums/favorites.php?s=
Im still gonna change a few other things but the biggest thing I want to change is the display order of the forums from alphabetical to numercial.. thanks in advance guys..