Log in

View Full Version : How to make moderators appear in alphabetical order on the moderator list?


too_cool_3
10-16-2008, 04:54 AM
I have moderators set-up on my forum (www.tbaec.ca (http://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 1224136606 at 1224136606 ---------------

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:
" . ($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
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:
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: 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: 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