Endless Paradigm

Full Version: Username colours and fonts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I decided to create this again, I think it's the same way Zinga uses.
I created 2 columns in the users table.
one for open tags and one for close (I know zinga uses only one :P).

I changed the user cp templates and created the do_format and format actions. (usercp.php)

It is for MyBB 1.4.

I also added the ability to have bold, strike, etc

The update queries(for the 2 columns) from the user cp work perfectly.

(only one theme works with the template right now)

But I am stuck in the format_name function.
here's mine:

Code:
function format_name($username, $usergroup, $displaygroup="", $pformat, $aformat)
{
	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 = $pformat."{username}".$aformat;
	}

	$format = stripslashes($format);

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


I have been practicing PHP, HTML and CSS :P I also made a module for my plaza but did not released it, I may release it once zinga updates my plaza. I also need to update my module.

This is specially directed to zinga.
But everyone who wants to help is welcomed.
thank you

Note: i don't get any errors but the formatting does not work.
I don't know if the problem is that function. IN the shoutbox, I added the pformat and aformat fields in the select query. ANd then changed this:
$row['username'] = format_name($row['username'], $row['usergroup'], $row['displaygroup']);
to:
$row['username'] = format_name($row['username'], $row['usergroup'], $row['displaygroup'], $row['pformat'], $row['aformat']);

select query:
$query = $db»query("SELECT s.*, u.username, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."sf_shouts s LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = s.uid) WHERE s.id>{$last_id} ORDER by s.id DESC LIMIT {$mybb»settings[sf_sb_shouts_main]}");

Try

Not sure there myself, but when it works can you wrap it in a plugin so I can have it? lol

Have you looked at ZB's function?

by the way I see you dumped phpfreechat. Any specific probs?
nah no problems, I just switched to the old shoutbox lol.
but yes I may make a plugin.
Fixed it :D
I did not see the userin.
I noticed the usergroup must always have {username} in its style, so changing the line:
$format = stripslashes($format);
to
$format = stripslashes($pformat.$format.$aformat);

will work :D
damn....!!! I need to learn programming ASAP!
Reference URL's