vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Reorganize Subscribed Forums by Numerical Order Instead Of Alphabetical Order (https://vborg.vbsupport.ru/showthread.php?t=39063)

larryd 05-26-2002 08:21 AM

Reorganize Subscribed Forums by Numerical Order Instead Of Alphabetical Order
 
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

Code:


// ############################### 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..

Dark_Wizard 05-26-2002 09:52 AM

Change this >> ORDER BY title << to what you need....could be id etc....

larryd 05-26-2002 10:02 AM

but what is the column name if its not title.. im not familair with the dbase setup

Admin 05-26-2002 10:29 AM

<font face="Courier">ORDER BY forum.forumid</font>

larryd 05-26-2002 10:38 AM

close but now i got a nother issue.. that did arrange them by forum id, but thats not the way there displayed on the main page, on the main page there displayed by Forum Order which is specified in the forum control panel.. can i do the same here?

Admin 05-26-2002 10:41 AM

That would be more complicated I'm afraid.

larryd 05-26-2002 10:43 AM

yeah i figured as much, I dont understand why it has to be so complex.. I mean I can figure out the logic

go through the forums the same way the main page does and display them in display order and only show them if its marked as a favorite.. this would be a nice hack if I could figure out this one last thing ;)

Dark_Wizard 05-26-2002 10:45 AM

Why not ORDER BY forum.displayorder

larryd 05-26-2002 10:47 AM

wow.. that was simple.. that worked.. I just didnt know the right identifier.. AWESOME.. thanks everyone ;) I might compile this whole mess up nicer and release it as a hack ;)

Admin 05-26-2002 10:49 AM

1 Attachment(s)
Quote:

Originally posted by Dark_Wizard
Why not ORDER BY forum.displayorder
Because displayorders gets reset under each category.

See the screenshot if you don't understand. :)

larryd 05-26-2002 10:51 AM

but it works if yers is setup like mine is.. which the #s just get higher as you go down the list starting at 100

Dark_Wizard 05-26-2002 11:50 AM

Quote:

Originally posted by FireFly

Because displayorders gets reset under each category.

See the screenshot if you don't understand. :)

Agreed, but doesn't it look at the parentid first?

Admin 05-26-2002 11:55 AM

It does on index.php, but it doesn't work that way in usercp.php -- which is why I said it would be more complicated.

Dark_Wizard 05-26-2002 11:57 AM

Quote:

Originally posted by FireFly
It does on index.php, but it doesn't work that way in usercp.php -- which is why I said it would be more complicated.
I just noticed that after I posted....


All times are GMT. The time now is 01:45 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01624 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete