View previous topic :: View next topic |
Author |
Message |
Doc.Fusion
Joined: 19 May 2003 Posts: 25
|
Posted: Mon May 26, 2003 5:08 pm Post subject: A stupid Hack (/me like in mIRC) |
|
|
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, "<font color=purple>* $nick \\1</font>", $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, "<font color=purple>* $nick \\1</font>", $content);
return ($content);
}
|
And in b2template.functions.php :
add Code: | $comment = convert_hack_me_comments($comment);
|
in Code: | function comment_text() {
global $commentdata;
$comment = stripslashes($commentdata['comment_content']);
$comment = str_replace('<trackback />', '', $comment);
$comment = str_replace('<pingback />', '', $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;
}
| (near line 895)
And add Code: | $content = convert_hack_me($content);
| 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;
}
| (near line 295)
That's all !
 |
|
Back to top |
|
 |
Tom
Joined: 11 Apr 2003 Posts: 6 Location: England
|
Posted: Mon May 26, 2003 6:55 pm Post subject: |
|
|
thats good.. doubt i'd use it though might have some other uses....  _________________ http://www.paper-bags.org |
|
Back to top |
|
 |
moose
Joined: 04 May 2003 Posts: 196 Location: Winnipeg Canada
|
Posted: Mon May 26, 2003 10:06 pm Post subject: |
|
|
cool i'm gonna use it... i don't know why though looks good. |
|
Back to top |
|
 |
gigantus
Joined: 30 Aug 2003 Posts: 12
|
Posted: Fri Sep 12, 2003 7:40 am Post subject: |
|
|
cool hack man!
can you make it so that it works with the comments
/me is a self proclaimed IRC addict _________________ //myBLOG||myART\\
 |
|
Back to top |
|
 |
CleverAlea
Joined: 06 Apr 2003 Posts: 10 Location: Tennessee
|
Posted: Fri Sep 19, 2003 6:26 pm Post subject: |
|
|
This is a neat hack, however, it does not display the author nickname before the the rest of the command line for me. In other words, it appears as: * Applauds everyone instead of * CleverAlea Applauds everyone. |
|
Back to top |
|
 |
Doc.Fusion
Joined: 19 May 2003 Posts: 25
|
Posted: Sun Sep 21, 2003 3:20 pm Post subject: |
|
|
gigantus wrote: | can you make it so that it works with the comments
|
In fact,
Code: | 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, "<font color=purple>* $nick \\1</font>", $content);
return ($content);
} |
and
Code: | function comment_text() {
global $commentdata;
$comment = stripslashes($commentdata['comment_content']);
$comment = str_replace('<trackback />', '', $comment);
$comment = str_replace('<pingback />', '', $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;
} |
should allow this hack work with the comments...
 |
|
Back to top |
|
 |
Doc.Fusion
Joined: 19 May 2003 Posts: 25
|
Posted: Sun Sep 21, 2003 4:03 pm Post subject: |
|
|
CleverAlea wrote: | This is a neat hack, however, it does not display the author nickname before the the rest of the command line for me. In other words, it appears as: * Applauds everyone instead of * CleverAlea Applauds everyone. |
Hum... is your blog a multi-user blog ? May I see your b2template.functions.php and your b2functions.php to test this ?
The main trouble is that $authordata seems to be null in your case...
Contact me via MSNM if you want |
|
Back to top |
|
 |
gigantus
Joined: 30 Aug 2003 Posts: 12
|
Posted: Mon Oct 20, 2003 9:16 am Post subject: |
|
|
kewl
thx _________________ //myBLOG||myART\\
 |
|
Back to top |
|
 |
xun88
Joined: 29 May 2004 Posts: 2
|
Posted: Sat May 29, 2004 11:30 am Post subject: Re: A stupid Hack (/me like in mIRC) |
|
|
[quote="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, "<font color=purple>* $nick \\1</font>", $content);
return ($content);
Can i know how to use it??and where to type in...where is this file?? thank you
Last edited by xun88 on Sat May 29, 2004 11:36 am; edited 1 time in total |
|
Back to top |
|
 |
xun88
Joined: 29 May 2004 Posts: 2
|
Posted: Sat May 29, 2004 11:33 am Post subject: re: DOC.fusion |
|
|
how to use this file and where to change this file and where to find this file? |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 369
|
Posted: Sat May 29, 2004 4:25 pm Post subject: |
|
|
You will find b2functions.php and b2template.functions.php in the b2-include folder of your b2 installation. Download them to your computer, make the changes suggested in a text editor and then uplaod them again. |
|
Back to top |
|
 |
|