MyBB Community Forums

Full Version: {$post['profilelink']} color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Thanks, I'll have a look at that one. Although I expected it to be available inline Sad
Same question here . I have the username_style installed on 1.4.13 ...works great . But doesnt display in some certain places as Patrick said . Is there an edit to certain files or templates that can utilise the colors all over the board?
Username Style is great but it wont display the colors of the username in Search , New posts etc
only in the Index page ( And the portal although I havent checked ) and the threads pages .
We would like it displayed board wide . Anyone have the fix for this?
this mod doesn;t work on portal page Sad
(2010-05-28, 02:35 AM)ismadman Wrote: [ -> ]Same question here . I have the username_style installed on 1.4.13 ...works great . But doesnt display in some certain places as Patrick said . Is there an edit to certain files or templates that can utilise the colors all over the board?
Username Style is great but it wont display the colors of the username in Search , New posts etc
only in the Index page ( And the portal although I havent checked ) and the threads pages .
We would like it displayed board wide . Anyone have the fix for this?

You can change it in global.css of your theme. Smile
They are not talking about that, darkly.
(2010-05-28, 02:35 AM)ismadman Wrote: [ -> ]Same question here . I have the username_style installed on 1.4.13 ...works great . But doesnt display in some certain places as Patrick said . Is there an edit to certain files or templates that can utilise the colors all over the board?
Username Style is great but it wont display the colors of the username in Search , New posts etc
only in the Index page ( And the portal although I havent checked ) and the threads pages .
We would like it displayed board wide . Anyone have the fix for this?
Look in the plugin files and see where it adds the color. The plugin is just missing a lot of templates.
here it is:

<?php
/**
 * MyBB 1.4 Username Style Plugin
 * Copyright © 2008 Phenomenon, All Rights Reserved
 */

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("global_start", "usernamestyle_global_start");
$plugins->add_hook("portal_start", "usernamestyle_portal_start");
$plugins->add_hook("portal_announcement", "usernamestyle_portal_announcement");
$plugins->add_hook("build_forumbits_forum", "usernamestyle_build_forumbits_forum");
$plugins->add_hook("forumdisplay_announcement", "usernamestyle_forumdisplay_announcement");
$plugins->add_hook("forumdisplay_thread", "usernamestyle_forumdisplay_thread");

function usernamestyle_info()
{
	global $lang;
	
	$lang->load("forum_usernamestyle", false, true);
	
	return array(
		"name" => $lang->usernamestyle,
		"description" => $lang->usernamestyle_desc,
		"website" => "http://www.force-opponents.de",
		"author" => "Phenomenon",
		"authorsite" => "http://www.force-opponents.de",
		"version" => "1.0.4",
		"guid" => "31717620d8fb072ab0cb328a85a9a88d",
		"compatibility" => "14*"
	);
}

function usernamestyle_activate()
{
	require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
	
	find_replace_templatesets("portal_announcement", "#".preg_quote("<a href=\"{\$mybb->settings['bburl']}/{\$announcement['profilelink']}\">{\$announcement['username']}</a>")."#i", "{\$announcement['profilelink']}");
	find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote("{\$modlist}")."#i", "{\$forum['modlist']}");
}

function usernamestyle_deactivate()
{
	require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
	
	find_replace_templatesets("portal_announcement", "#".preg_quote("{\$announcement['profilelink']}")."#i", "<a href=\"{\$mybb->settings['bburl']}/{\$announcement['profilelink']}\">{\$announcement['username']}</a>", 0);
	find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote("{\$forum['modlist']}")."#i", "{\$modlist}", 0);
}

function usernamestyle_global_start()
{
	global $mybb, $current_page;
	
	// Create global var to save modlist setting
	// We only need that var on index.php and forumdisplay.php
	if($current_page == "index.php" || $current_page == "forumdisplay.php")
	{
		global $modlistsetting;
		
		$modlistsetting = $mybb->settings['modlist'];
	}
}

function usernamestyle_portal_start()
{
	global $db, $mybb, $lang, $theme, $templates, $latestthreads;
	
	// Latest forum discussions
	if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])
	{
		$threadlist = "";
		$altbg = alt_trow();
		$unviewable = get_unviewable_forums();
		
		if($unviewable)
		{
			$unviewwhere = " AND fid NOT IN (".$unviewable.")";
		}
		
		$query = $db->query("
			SELECT t.*, u.usergroup, u.displaygroup
			FROM ".TABLE_PREFIX."threads t
			LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.lastposteruid)
			WHERE 1 = 1".$unviewwhere." AND t.visible = '1' AND t.closed NOT LIKE 'moved|%'
			ORDER BY t.lastpost DESC 
			LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
		);
		
		while($thread = $db->fetch_array($query))
		{
			$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
			$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
			
			if($thread['lastposteruid'] == 0)
			{
				$lastposterlink = $thread['lastposter'];
			}
			else
			{
				$thread['lastposter'] = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
				$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
			}
			
			if(my_strlen($thread['subject']) > 25)
			{
				$thread['subject'] = my_substr($thread['subject'], 0, 25)."...";
			}
			
			$thread['subject'] = htmlspecialchars_uni($thread['subject']);
			$thread['threadlink'] = get_thread_link($thread['tid']);
			
			eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
			
			$altbg = alt_trow();
		}
		
		if($threadlist)
		{ 
			eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
		}
	}
	
	// To avoid overwriting by original code segment
	$mybb->settings['portal_showdiscussions'] = 0;
}

function usernamestyle_portal_announcement()
{
	global $db, $announcement;
	
	// Format announcement author name
	
	// This piece of code and the template replacement will fix also a little bug
	// where guests have a profile link (If you allow guests to post announcements =))
	if($announcement['uid'] == 0)
	{
		$announcement['profilelink'] = $announcement['username'];
	}
	else
	{
		$query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$announcement['uid']."'");
		$user = $db->fetch_array($query);
		
		$announcement['username'] = format_name($announcement['username'], $user['usergroup'], $user['displaygroup']);
		$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
	}
}

function usernamestyle_build_forumbits_forum(&$forum)
{
	global $db, $mybb, $lang, $templates, $moderatorcache, $modlistsetting;
	
	// Moderator column is not off
	$mybb->settings['modlist'] = $modlistsetting;
	
	if($mybb->settings['modlist'] != 0)
	{
		$moderators = "";
		$donemoderators = array();
		$parentlist = explode(",", $forum['parentlist']);
		
		foreach($parentlist as $fid)
		{
			if(is_array($moderatorcache[$fid]))
			{
				foreach($moderatorcache[$fid] as $moderator)
				{
					if(in_array($moderator['uid'], $donemoderators))
					{
						continue;
					}
					
					$moderator['username'] = format_name($moderator['username'], $moderator['usergroup'], $moderator['displaygroup']);
					$moderator['profilelink'] = build_profile_link($moderator['username'], $moderator['uid']);
					
					$moderators .= $comma;
					$moderators .= $moderator['profilelink'];
					
					$comma = ", ";
					
					$donemoderators[] = $moderator['uid'];
				}
			}
		}
		
		$comma = "";
		
		if($moderators)
		{
			eval("\$forum['modlist'] = \"".$templates->get("forumbit_moderators")."\";");
		}
		else
		{
			$forum['modlist'] = "";
		}
	}
	
	// To avoid overwriting by original code segment
	$mybb->settings['modlist'] = 0;
	
	// Format lastposter name
	$query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$forum['lastposteruid']."'");
	$user = $db->fetch_array($query);
	
	$forum['lastposter'] = format_name($forum['lastposter'], $user['usergroup'], $user['displaygroup']);
}

function usernamestyle_forumdisplay_announcement()
{
	global $db, $announcement;
	
	// Format announcement author name
	$query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$announcement['uid']."'");
	$user = $db->fetch_array($query);
	
	$announcement['username'] = format_name($announcement['username'], $user['usergroup'], $user['displaygroup']);
	$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
}

function usernamestyle_forumdisplay_thread()
{
	global $db, $thread;
	
	// Format thread author name
	if($thread['username'])
	{
		$query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$thread['uid']."'");
		$user = $db->fetch_array($query);
		
		$thread['username'] = format_name($thread['username'], $user['usergroup'], $user['displaygroup']);
	}
	
	// Format lastposter name
	if($thread['lastposteruid'] != 0)
	{
		$query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$thread['lastposteruid']."'");
		$lastposter = $db->fetch_array($query);
		
		$thread['lastposter'] = format_name($thread['lastposter'], $lastposter['usergroup'], $lastposter['displaygroup']);
	}
}
?>
Yeah thanks leelax and Bob but thats identical to the file I have . Do you have the edits for that file to make the colors forum wide and not just threads and index?
I have already been through it and for the life of me can't work it out ..... Even if you point me in the right direction with making it go to one other template I could work it out from there .
Did you try adding the templates to the hooks in the beginning? Like:

$plugins->add_hook("memberlist_user", "usernamestyle_memberlist_user);
I am not too familiar with MyBB's plugins system so you will have to wait for support from Matt or Tim.
no bob i didnt , but i will try , although its almost 3:30 am and im buggered lol .
Will give it a go in the morning ...
I'll let you know how I get on Big Grin
OK no good Sad
I added the hooks in the header pointing to search_results_thread_thread
And did nothing . So anyone help with what to add to the above file to make the user colors show up in search results ( New posts etc )
Just a clue even what to do
Thanks
Pages: 1 2 3