boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A stupid Hack (/me like in mIRC)

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Doc.Fusion



Joined: 19 May 2003
Posts: 25

PostPosted: Mon May 26, 2003 5:08 pm    Post subject: A stupid Hack (/me like in mIRC) Reply with quote

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 !
Very Happy
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Tom



Joined: 11 Apr 2003
Posts: 6
Location: England

PostPosted: Mon May 26, 2003 6:55 pm    Post subject: Reply with quote

thats good.. doubt i'd use it though might have some other uses.... Smile
_________________
http://www.paper-bags.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
moose



Joined: 04 May 2003
Posts: 196
Location: Winnipeg Canada

PostPosted: Mon May 26, 2003 10:06 pm    Post subject: Reply with quote

cool Smile i'm gonna use it... i don't know why though Razz looks good.
Back to top
View user's profile Send private message Visit poster's website
gigantus



Joined: 30 Aug 2003
Posts: 12

PostPosted: Fri Sep 12, 2003 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
CleverAlea



Joined: 06 Apr 2003
Posts: 10
Location: Tennessee

PostPosted: Fri Sep 19, 2003 6:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Doc.Fusion



Joined: 19 May 2003
Posts: 25

PostPosted: Sun Sep 21, 2003 3:20 pm    Post subject: Reply with quote

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...
Smile
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Doc.Fusion



Joined: 19 May 2003
Posts: 25

PostPosted: Sun Sep 21, 2003 4:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
gigantus



Joined: 30 Aug 2003
Posts: 12

PostPosted: Mon Oct 20, 2003 9:16 am    Post subject: Reply with quote

kewl

thx
_________________
//myBLOG||myART\\
Back to top
View user's profile Send private message Visit poster's website
xun88



Joined: 29 May 2004
Posts: 2

PostPosted: Sat May 29, 2004 11:30 am    Post subject: Re: A stupid Hack (/me like in mIRC) Reply with quote

[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
View user's profile Send private message Send e-mail MSN Messenger
xun88



Joined: 29 May 2004
Posts: 2

PostPosted: Sat May 29, 2004 11:33 am    Post subject: re: DOC.fusion Reply with quote

how to use this file and where to change this file and where to find this file?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
stevem



Joined: 15 Mar 2003
Posts: 369

PostPosted: Sat May 29, 2004 4:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group