MyBB Community Forums

Full Version: Thread Prefix on Forum Index
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi guys,
I developed and just tested out on mybb 1.6 a code modification to showing up thread prefixes on forum index.

Original dev-link:
http://www.methack.it/forum/thread-modif...forum.html


Follow these simple steps and enjoy... Wink

Open /inc/functions_forumlist.php
Find:
global $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers;

Replace with:
global $db, $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers;


Find:
elseif($hideinfo != true)
{

Replace with:
elseif($hideinfo != true)
{
	/************** Show prefix on index ************ */
        // @Author: Mattia
        // @Web: www.methack.it/forum/
	// Get the thread details from the database.
	$thread = get_thread($lastpost_data['lastposttid']);
	// Get thread prefix if there is one.
	$thread['threadprefix'] = '';
	$thread['displayprefix'] = '';
	if($thread['prefix'] != 0)
	{
		$query = $db->simple_select('threadprefixes', 'prefix, displaystyle', "pid='{$thread['prefix']}'");
		$threadprefix = $db->fetch_array($query);
					
		$thread['threadprefix'] = $threadprefix['prefix'].' ';
		$thread['displayprefix'] = $threadprefix['displaystyle'].' ';
	}
	/************** End show prefix ***************** */

Find:
$lastpost_subject = $full_lastpost_subject = $parser->parse_badwords($lastpost_data['lastpostsubject']);

Replace with:
$lastpost_subject = $full_lastpost_subject = $thread['threadprefix'] . $parser->parse_badwords($lastpost_data['lastpostsubject']);
Approved.

Looks cool might use it sometime Smile
Error.

Call to a member function simple_select() on a non-object in........................
Fatal error: Call to a member function simple_select() on a non-object in /home/walkman/public_html/foro/inc/functions_forumlist.php on line 234
(2010-09-02, 01:10 AM)ozanakkaya Wrote: [ -> ]Error.

Call to a member function simple_select() on a non-object in........................

(2010-09-02, 07:57 PM)Walkman 5.0 Wrote: [ -> ]Fatal error: Call to a member function simple_select() on a non-object in /home/walkman/public_html/foro/inc/functions_forumlist.php on line 234

Sorry, i forgot writing one step. Check the new one into the first post! Sorry again!
to showing the prefix you need add tis to your template
{$thread['displayprefix']}
This isn't actually a plugin, user submitted tutorials is where this belongs.
I get this error.
Parse error: syntax error, unexpected $end in /mcmines.com/inc/functions_forumlist.php on line 514
so it works on my forum (1.6.3)
but one little thing. leave step 3 and edit the "forumbit_depth2_forum_lastpost" template
add {$thread['displayprefix']} after <span class="smalltext"> and save.
your prefixes will be shown with the right formatting and will not be a part of the url.

thanks for this little helpfully snippet

@blake
there is no $end variable in the snippet. check your code on syntax errors e.g. missing () {} or undefined variables
(2011-05-22, 10:21 AM)h4ppycor3 Wrote: [ -> ]so it works on my forum (1.6.3)
but one little thing. leave step 3 and edit the "forumbit_depth2_forum_lastpost" template
add {$thread['displayprefix']} after <span class="smalltext"> and save.
your prefixes will be shown with the right formatting and will not be a part of the url.

thanks for this little helpfully snippet

@blake
there is no $end variable in the snippet. check your code on syntax errors e.g. missing () {} or undefined variables

Thanks for your suggest! Wink
Pages: 1 2