MyBB Community Forums

Full Version: Make manually code usernames styles
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Does anyone know how to make a coding for usernames styles color to show everywhere..i already use plugin but only a few places it showing,so i try to find manually code to add some places in my templates.

for example like this:
[Image: Untitled.png]
By using the format_name() function. You need to look up the new registered member code in index.php.
(2016-08-27, 08:07 PM)Sazze Wrote: [ -> ]By using the format_name() function. You need to look up the new registered member code in index.php.

You mean this code..
function format_name($username, $usergroup, $displaygroup=0)
{
	global $groupscache, $cache;
	if(!is_array($groupscache))
	{
		$groupscache = $cache->read("usergroups");
	}
	if($displaygroup != 0)
	{
		$usergroup = $displaygroup;
	}
	$ugroup = $groupscache[$usergroup];
	$format = $ugroup['namestyle'];
	$userin = substr_count($format, "{username}");
	if($userin == 0)
	{
		$format = "{username}";
	}
	$format = stripslashes($format);
	return str_replace("{username}", $username, $format);
}
Maybe can help you those information of username styles...
https://community.mybb.com/thread-73891.html
(2016-08-28, 03:51 AM)DiegoPino Wrote: [ -> ]Maybe can help you those information of username styles...
https://community.mybb.com/thread-73891.html

Those information for make usernames sparkles, what i need is how to make code for showing usernames sparkles so i can add any places i want to showing those sparkles. **Sry for my bad english** hope you guys understand what i'm try to explain. Big Grin Big Grin
Just modify the Username field of group where you want to show sparkles in Admin CP with this code.
<span style="color: Green; background: transparent url(Sparkle GIF Image link);">{username}</span>
You can google sparkle glittering images or anything you want Smile
(2016-08-28, 11:00 AM)WallBB Wrote: [ -> ]Just modify the Username field of group where you want to show sparkles in Admin CP with this code.
<span style="color: Green; background: transparent url(Sparkle GIF Image link);">{username}</span>
You can google sparkle glittering images or anything you want Smile

again..didn't you read my post on top.
He wants to know how he can edit the core files in order to display the current usegroup style in all the templates.

There's a plugin that colour almost all the templates if you want to try it.
(2016-08-28, 01:57 PM)eNvy Wrote: [ -> ]He wants to know how he can edit the core files in order to display the current usegroup style in all the templates.

There's a plugin that colour almost all the templates if you want to try it.

Yeah u right that what i mean..

do u know how to make or edit? can you show me how.
(2016-08-28, 03:05 PM)Luis Dirjan Wrote: [ -> ]
(2016-08-28, 01:57 PM)eNvy Wrote: [ -> ]He wants to know how he can edit the core files in order to display the current usegroup style in all the templates.

There's a plugin that colour almost all the templates if you want to try it.

Yeah u right that what i mean..

do u know how to make or edit? can you show me how.

Well I think this "tutorial" was for MyBB 1.6 so... if you want to try it be careful because probably the code changed from one version to another (I don't know if this work or not).

Also this is not 100% in all the templates, but maybe you can learn how to style it for yourself and make the changes.

functions_forumlist.php

Search

$lastpost_profilelink = build_profile_link($lastpost_data['lastposter'], $lastpost_data['lastposteruid']);

Replace with

$user_profile_forum = get_user($lastpost_data['lastposteruid']);
					$lastpost_data['lastposter'] = format_name($user_profile_forum['username'], $user_profile_forum['usergroup'], $user_profile_forum['displaygroup']);
					$lastpost_profilelink = build_profile_link($lastpost_data['lastposter'], $lastpost_data['lastposteruid']);

forumdisplay.php

Search

$thread['author'] = $thread['uid'];
		if(!$thread['username'])
		{
			$thread['username'] = $thread['threadusername'];
			$thread['profilelink'] = $thread['threadusername'];
		}
		else
		{
			$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
		}

Replace with

$thread['author'] = $thread['uid'];
		if(!$thread['username'])
		{
			$thread['username'] = $thread['threadusername'];
			$thread['profilelink'] = $thread['threadusername'];
		}
		else
		{
			$userformat = get_user($thread['uid']);
			$thread_format = format_name($userformat['username'], $userformat['usergroup'], $userformat['displaygroup']);
			$thread['profilelink'] = build_profile_link($thread_format, $thread['uid']);
		}

Search

// Don't link to guest's profiles (they have no profile).
		if($lastposteruid == 0)
		{
			$lastposterlink = $lastposter;
		}
		else
		{
			$lastposterlink = build_profile_link($lastposter, $lastposteruid);
		}

Replace with

if($lastposteruid == 0)
		{
			$lastposterlink = $lastposter;
		}
		else
		{
			$user_lastpost = get_user($lastposteruid);
			$lastposter_formar = format_name($user_lastpost['username'], $user_lastpost['usergroup'], $user_lastpost['displaygroup']);
			$lastposterlink = build_profile_link($lastposter_formar, $user_lastpost['uid']);
		}

portal.php

Search

if($thread['lastposteruid'] == 0)
		{
			$lastposterlink = $thread['lastposter'];
		}
		else
		{
			$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
		}

Replace with

if($thread['lastposteruid'] == 0)
		{
			$lastposterlink = $thread['lastposter'];
		}
		else
		{
			$user_portal_format = get_user($thread['lastposteruid']);
			$portal_lastposter_thread = format_name($user_portal_format['username'], $user_portal_format['usergroup'], $user_portal_format['displaygroup']);
			$lastposterlink = build_profile_link($portal_lastposter_thread, $user_portal_format['uid']);
		}

Search

if($announcement['uid'] == 0)
	{
		$profilelink = htmlspecialchars_uni($announcement['threadusername']);
	}
	else
	{
		$profilelink = build_profile_link($announcement['username'], $announcement['uid']);
	}

Replace with

if($announcement['uid'] == 0)
	{
		$profilelink = htmlspecialchars_uni($announcement['threadusername']);
	}
	else
	{
		$portaluserlink = get_user($announcement['uid']);
		$namelinkportal = format_name($portaluserlink['username'], $portaluserlink['usergroup'], $portaluserlink['displaygroup']);
		$profilelink = build_profile_link($namelinkportal, $portaluserlink['uid']);
	}

Credits: Edson Ordaz
Link: http://www.mybb-es.com/hilo-formato-del-...das-partes (Spanish)
Pages: 1 2