MyBB Community Forums

Full Version: Can I adjust the prefix position?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I setup some prefixes on my forums, and later when I added more prefixes to the forums, I found the new prefixes can only list after the old prefixes in the "New Thread" and "Edit Post" window. It seems that all the prefixes are shown according to the time when you added them. Is there a function in MyBB to adjust the positions of the prefixes? Thanks.
Go to admin/modules/config >>> Open "thread_prefixes.php" file.

Find the following;

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

and Change it to;

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

In this small tweak, you can arrange them in "Prefix ID" order. (Means the date it created.)
(2010-11-19, 03:42 PM)Yaldaram Wrote: [ -> ]Go to admin/modules/config >>> Open "thread_prefixes.php" file.

Find the following;

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

and Change it to;

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

In this small tweak, you can arrange them in "Prefix ID" order. (Means the date it created.)

Thanks for your reply, but I found the prefixes are shown according to the date it created in MyBB currently (in the new thread window and edit post window), and I would like to define the positions of the prefixes myself.

Then request a plugin for it.
Thanks, but can I do a tweak that at least I can show the prefixes according to their names order instead of their creation date? I mean the prefix lists in the new tread window and the edit post window, since the prefixes are already shown according to their names order in the prefixes setup section in the Admin CP.
As you can see from my attached image, the new prefixes are shown under the old prefixes, and the old prefixes like "Others" are shown above the new prefixes which looks weird. I want to move the "Others" prefix to the bottom of the lists, or at least I can sort all the prefixes according to their names.
To sort them by name, open ./inc/functions.php and find:
			$query = $db->query("
				SELECT pid, prefix
				FROM ".TABLE_PREFIX."threadprefixes
				WHERE ({$extra_sql}CONCAT(',',groups,',') LIKE '%,{$mybb->user['usergroup']},%' OR CONCAT(',',groups,',') LIKE '%,-1,%' OR groups='')
				{$whereforum}
			");

Replace with:
			$query = $db->query("
				SELECT pid, prefix
				FROM ".TABLE_PREFIX."threadprefixes
				WHERE ({$extra_sql}CONCAT(',',groups,',') LIKE '%,{$mybb->user['usergroup']},%' OR CONCAT(',',groups,',') LIKE '%,-1,%' OR groups='')
				{$whereforum}
				ORDER BY prefix
			");
(2010-11-19, 08:45 PM)AJS Wrote: [ -> ]To sort them by name, open ./inc/functions.php and find:
			$query = $db->query("
				SELECT pid, prefix
				FROM ".TABLE_PREFIX."threadprefixes
				WHERE ({$extra_sql}CONCAT(',',groups,',') LIKE '%,{$mybb->user['usergroup']},%' OR CONCAT(',',groups,',') LIKE '%,-1,%' OR groups='')
				{$whereforum}
			");

Replace with:
			$query = $db->query("
				SELECT pid, prefix
				FROM ".TABLE_PREFIX."threadprefixes
				WHERE ({$extra_sql}CONCAT(',',groups,',') LIKE '%,{$mybb->user['usergroup']},%' OR CONCAT(',',groups,',') LIKE '%,-1,%' OR groups='')
				{$whereforum}
				ORDER BY prefix
			");

Thank you very much, problem solved! Smile