MyBB Hacks

Full Version: [SOLVED] How to sort Thread Prefixes menu in a new thread by name (not by ID)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?

Solved Smile
(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?
You are right, sorry Smile

Here is the solution:

Find in /inc/class_datacache.php

Code:
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:
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);
    }

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 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.
(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....)
Reference URL's