Page 1 of 1

You, me, we and us BBCode

Posted: 09 Mar 2010, 21:34
by BBCode Bot
You, me, we and us BBCode

Author: Mickroz
Description: With the You, me, we and us BBCode you can use tags that will show viewers name, posters name, posters and viewers name, boardname in the posts.
Image

File edits

Open: includes/ucp/ucp_pm_viewmessage.php
Find:

Code: Select all

$message = bbcode_nl2br($message);
	$message = smiley_text($message);
Add after:

Code: Select all

$your_username = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour'], $user->lang['GUEST']);
	$my_username = get_username_string('full', $message_row['user_id'], $message_row['username'], $message_row['user_colour']);

	$find = array('[we]', '[me]', '[you]', '[us]');
	$replace = array(
		"$your_username and $my_username",
		$my_username,
		$your_username,
		'<span style="color: red;">' . $config['sitename'] . '</span>',
	);

	$message = str_replace($find, $replace, $message);
Open: viewtopic.php
Find:

Code: Select all

$message = bbcode_nl2br($message);
	$message = smiley_text($message);
Add after:

Code: Select all

$your_username = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour'], $user->lang['GUEST']);
	$my_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

	$find = array('[we]', '[me]', '[you]', '[us]');
	$replace = array(
		"$your_username and $my_username",
		$my_username,
		$your_username,
		'<span style="color: red;">' . $config['sitename'] . '</span>',
	);

	$message = str_replace($find, $replace, $message);

Now we need to create 4 BBCodes

You, showing viewers name
BBCode:

Code: Select all

[you][/you]
HTML:

Code: Select all

[you]
Helpline:

Code: Select all

[you] Viewers name: [you][/you]
Example:

Code: Select all

[you][/you]
Demo:
[you][/you]

Me, showing posters name
BBCode:

Code: Select all

[me][/me]
HTML:

Code: Select all

[me]
Helpline:

Code: Select all

[me] Posters name: [me][/me]
Example:

Code: Select all

[me][/me]
Demo:
[me][/me]

We, showing posters & viewers name
BBCode:

Code: Select all

[we][/we]
HTML:

Code: Select all

[we]
Helpline:

Code: Select all

[we] Posters & Viewers name: [we][/we]
Example:

Code: Select all

[we][/we]
Demo:
[we][/we]

Us, showing board name
BBCode:

Code: Select all

[us][/us]
HTML:

Code: Select all

[us]
Helpline:

Code: Select all

[us] Board name: [us][/us]
Example:

Code: Select all

[us][/us]
Demo:
[us][/us]

Re: You, me, we and us BBCode

Posted: 12 Jun 2010, 17:11
by andredmau5
it works!.. but unfortunately for the signature it doesn't =(

Re: You, me, we and us BBCode

Posted: 10 Aug 2010, 22:21
by Eliram-p
Nice, i love it :)