Post Reply 
Username colours and fonts
Just need one thing to finish it
Author Message
Pirata Nervo
NervOS Developer

Posts: 699.4765
Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
Offline
Post: #1
Username colours and fonts
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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]}");


14/08/2008 04:26 PM
Visit this user's website Find all posts by this user Quote this message in a reply
MaDc0w
need...steak....sauce.....

Posts: 255.3702
Threads: 22
Joined: 15th Apr 2007
Reputation: -6.35773
E-Pigs: 10.1397
Offline
Post: #2
RE: Username colours and fonts
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?

http://www.pac-rom.com

    (__)
  <@ 0>    m0o
     \_/
14/08/2008 05:20 PM
Find all posts by this user Quote this message in a reply
Pirata Nervo
NervOS Developer

Posts: 699.4765
Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
Offline
Post: #3
RE: Username colours and fonts
nah no problems, I just switched to the old shoutbox lol.
but yes I may make a plugin.

14/08/2008 05:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Pirata Nervo
NervOS Developer

Posts: 699.4765
Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
Offline
Post: #4
RE: Username colours and fonts
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

14/08/2008 05:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
feinicks
One day... we Fly...

Posts: 6,124.6050
Threads: 531
Joined: 27th Mar 2008
Reputation: 2.35695
E-Pigs: 210817.3958
Offline
Post: #5
RE: Username colours and fonts
damn....!!! I need to learn programming ASAP!

◄◄••• 天使たちの夢か? •••►►

[Image: ewualizer.gif]
My works!
14/08/2008 09:02 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: