vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to make moderators appear in alphabetical order on the moderator list? (https://vborg.vbsupport.ru/showthread.php?t=193750)

too_cool_3 10-16-2008 04:54 AM

How to make moderators appear in alphabetical order on the moderator list?
 
I have moderators set-up on my forum (www.tbaec.ca) but on the main forum page, the /forum/index.php page where it lits - Forums - Last Post - Threads - Posts - Moderator - it has the moderators listed under Moderator in a different order depending on the category. Is there a way I can make them listed alphabetically instead of just at random?

I have tried adding them in ACP starting with the last username in alphabetical order as well as adding them starting with the first username in alphabetical order but they still sometimes appear in whatever order they feel regardless of the oder in which they are added?!

Is there a way to make them show up listed first to last, A-Z, not just mis-matched? In my opinion it just makes the forum look un-organized and is just something that has been bugging me so any help is appreciated!

Thank you for your time,
-Marc

--------------- Added [DATE]1224136606[/DATE] at [TIME]1224136606[/TIME] ---------------

NOTE: how MarcGSR appears at the bottom of the list instead of in between Frogg & Neeman77 like it should be if it was alphabetical order...

https://vborg.vbsupport.ru/external/2008/10/32.jpg




I've tried fooling around with it and it STILL list the mods in random order! This is really bugging me :|

https://vborg.vbsupport.ru/external/2008/10/33.jpg

Lynne 10-16-2008 03:55 PM

Hi again. I decided to do a quick try of what I was suggesting over on vb.com. Go to includes/functions_forumlist.php and find the query around line 21. At the end of the query you need to add "ORDER BY user.username ASC". This is what my line 26 and 27 look like when I add this:
PHP Code:

        " . ($userid != null ? "WHERE moderator.userid " . intval($userid) : "") . "ORDER BY user.username ASC
    
"); 

It seemed to work.

too_cool_3 10-16-2008 05:19 PM

Oh perfect, I will try that out later tonight when I get home from work. Thank you very much!

So now I presume it won't matter which order I add the mods, they will just get sorted into alphabetical order?

P.S. Strange that vB doesn't do this naturally... I figured that more people would have been bothered by this issue and having their mods showing up in random order.

msibm 12-04-2009 08:24 AM

Great! Thanks to Lynne!

james shadle 02-14-2013 03:27 PM

I got my Mods to display in order in the forum list, but it messed up the PMs.
Database error - wrong syntax.

Any ideas?
Thanks

Lynne 02-14-2013 04:18 PM

Quote:

Originally Posted by james shadle (Post 2404244)
I got my Mods to display in order in the forum list, but it messed up the PMs.
Database error - wrong syntax.

Any ideas?
Thanks

Post the code original code and then the modified code (just five lines above and below the code so we can tell where it is) and the file name so we can see what you did. Please use the php tags.

james shadle 02-14-2013 04:33 PM

This is the message I received:
Code:

                SELECT moderator.*, user.username,
                                  IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid
                                  FROM moderator AS moderator
                                  INNER JOIN user AS user USING(userid)
                                    WHERE moderator.userid = 444ORDER BY moderator.userid;
 
  MySQL Error  : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY moderator.userid' at line 5

includes/functions_forumlist.php

This was the original code:
Code:

IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid
        FROM " . TABLE_PREFIX . "moderator AS moderator
        INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
        " . ($userid != null ? "WHERE moderator.userid = " . intval($userid) : "") . "
    ");
    while ($moderator = $vbulletin->db->fetch_array($forummoderators))
    {
        fetch_musername($moderator);
        $imodcache["$moderator[forumid]"]["$moderator[userid]"] = $moderator;
        $mod["$moderator[userid]"] = 1;
    }


I cut and pasted your code:
Code:

IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid
        FROM " . TABLE_PREFIX . "moderator AS moderator
        INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
              " . ($userid != null ? "WHERE moderator.userid = " . intval($userid) : "") . "ORDER BY user.username ASC
    ");

    while ($moderator = $vbulletin->db->fetch_array($forummoderators))
    {
        fetch_musername($moderator);
        $imodcache["$moderator[forumid]"]["$moderator[userid]"] = $moderator;
        $mod["$moderator[userid]"] = 1;
    }


Thanks

Lynne 02-14-2013 04:49 PM

Add a space before the ORDER.

james shadle 02-14-2013 09:32 PM

Lynne,
Thank you!
That worked.
James


All times are GMT. The time now is 07:03 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.01165 seconds
  • Memory Usage 1,739KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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