MyBB Community Forums

Full Version: custom profile field inside a group style
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello

today i wanted do a trick of put inside usergroup styling the custom profile id. The problem is that unique available content is "{username}". Tere is any modification to allow {$mybb->user['pid4']} ??
You want an exact users id or the "user"?
{$mybb->user['uid']}

The above I think would work for the "user".
i want take the cistom pid from user that is set in {username}
BUMP!
I have solved it manually, here is a function.php modified format_name if someone will need it Smile

function format_name($username, $usergroup, $displaygroup="")
{
	global $groupscache, $cache, $db;
	
	if(!is_array($groupscache))
	{
		$groupscache = $cache->read("usergroups");
	}

	if($displaygroup != 0)
	{
		$usergroup = $displaygroup;
	}
	
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE username = '".$username."'");
	$uid = $db->fetch_field($query, "uid");
	
	$query2 = $db->query("SELECT * FROM ".TABLE_PREFIX."userfields WHERE ufid = '".$uid."'");
	$fid4 = $db->fetch_field($query2, "fid4");
	
	$ugroup = $groupscache[$usergroup];
	$format = $ugroup['namestyle'];
	$userin = substr_count($format, "{username}");

	if($userin == 0)
	{
		$format = "{username}";
	}

	$format = stripslashes($format);
	
	$format = str_replace("{fid4}", $fid4, $format);

	return str_replace("{username}", $username, $format);
}