[SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
Divvy Offline
Junior Member
**
Posts: 37
Joined: Jan 2012
Post: #1
[SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
I wish to change the thread prefix order by name instead of prefix id which is default. I found this topic on myBB wiki, but I could not find the related text in the file mentioned in the wiki:

Code:
http://wiki.mybb.com/index.php/Admin_CP_Config_Thread_Prefixes#Can_I_change_the_thread_prefix_order_on_their_liā€‹stings_.3F


Can someone help me?

(This post was last modified: 03-25-2012 02:27 AM by Divvy.)
03-24-2012 11:13 AM
Find all posts by this user Quote this message in a reply
Divvy Offline
Junior Member
**
Posts: 37
Joined: Jan 2012
Post: #2
RE: How to sort Thread Prefixes menu in a new thread by name (not by ID)
Solved Smile
03-25-2012 02:26 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: How to sort Thread Prefixes menu in a new thread by name (not by ID)
(03-25-2012 02:26 AM)Divvy Wrote:  Solved Smile

Rather than just saying solved, why not post how you solved it for other users who might be interested?


[Image: leelink.gif]
MYBB1.6 & XThreads
03-25-2012 04:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Divvy Offline
Junior Member
**
Posts: 37
Joined: Jan 2012
Post: #4
RE: [SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
You are right, sorry Smile

Here is the solution:

Find in /inc/class_datacache.php

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function update_threadprefixes()
    {
        global $db;

        $prefixes = array();
        $query = $db->simple_select("threadprefixes", "*", "", array("order_by" => "pid"));

        while($prefix = $db->fetch_array($query))
        {
            $prefixes[$prefix['pid']] = $prefix;
        }

        $this->update("threadprefixes", $prefixes);
    }


Replace with:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function update_threadprefixes()
    {
        global $db;

        $prefixes = array();
        $query = $db->simple_select("threadprefixes", "*", "", array("order_by" => "prefix"));

        while($prefix = $db->fetch_array($query))
        {
            $prefixes[$prefix['pid']] = $prefix;
        }

        $this->update("threadprefixes", $prefixes);
    }

03-25-2012 05:05 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #5
RE: [SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
Maybe you need to run the Rebuild Cache for the threadprefix cache after change the order (or, you can re-save a thread prefix, so MyBB will rebuild the cache).

03-25-2012 02:16 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: [SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
(03-25-2012 04:43 AM)leefish Wrote:  Rather than just saying solved, why not post how you solved it for other users who might be interested?
Because asking in multiple forums not only ++postcount, but gives yourself more attention.

If you're going to post a question on the MyBB community forums, please don't post it here.

My Blog
03-25-2012 08:58 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: [SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
(03-25-2012 08:58 PM)ZiNgA BuRgA Wrote:  Because asking in multiple forums not only ++postcount, but gives yourself more attention.

Oh right, sorry, I did not realise he was asking all over the mybb community.

(boosts post count by one....)


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 03-25-2012 10:24 PM by leefish.)
03-25-2012 10:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: