# /ME LIKE IN mIRC #
by Doc.Fusion
OK, let's display our name and our action in purple, if we write something
begginning with "/me".
Example :
/me is happy to show you this stupid hack
become :
* Doc.Fusion is happy to show you this stupid hack
To do that :
in b2functions.php
[code]
function convert_hack_me($content) {
global $authordata;
//var_dump($authordata);
$nick=$authordata['user_nickname'];
$exp="/me([^(\n)]*)";
//$authjkl=the_author();
$content = ereg_replace($exp, "* $nick \\1", $content);
return ($content);
}
function convert_hack_me_comments($content) {
global $commentdata;
//var_dump($authordata);
$nick=$commentdata['comment_author'];
$exp="/me([^(\n)]*)";
//$authjkl=the_author();
$content = ereg_replace($exp, "* $nick \\1", $content);
return ($content);
}
[/code]
And in b2template.functions.php :
add
[code]
$comment = convert_hack_me_comments($comment);
[/code]
in
[Code]
function comment_text() {
global $commentdata;
$comment = stripslashes($commentdata['comment_content']);
$comment = str_replace('', '', $comment);
$comment = str_replace('', '', $comment);
$comment = convert_chars($comment);
$comment = convert_bbcode($comment);
$comment = convert_gmcode($comment);
$comment = convert_smilies($comment);
$comment = convert_hack_me_comments($comment);
$comment = make_clickable($comment);
$comment = balanceTags($comment);
$comment = apply_filters('comment_text', $comment);
echo $comment;
}
[/code]
(near line 895)
And add
[Code]
$content = convert_hack_me($content);
[/code]
in
[code]
function the_content($more_link_text='(more...)', $stripteaser=0, $more_file='') {
$content = get_the_content($more_link_text,$stripteaser,$more_file);
$content = convert_bbcode($content);
$content = convert_gmcode($content);
$content = convert_smilies($content);
$content = convert_hack_me($content);
$content = convert_chars($content, 'html');
$content = apply_filters('the_content', $content);
echo $content;
}
[/code]
(near line 295)
That's all !
// SIDESTEP (added 25.01.05)
If you're worried about (x)html validation, as you should, change
with and with
in the above code. The result will be the same, and you don't step on anyone's toes.
Source: http://www.cafelog.com/board/viewtopic.php?t=3243