Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
/me code Version 3 Details »»
/me code Version 3
Version: 3.00, by Erwin Erwin is offline
Developer Last Online: May 2013 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 01-04-2004 Last Update: Never Installs: 200
 
No support by the author.

Updated version 2.00 thanks to buro9!

Updated version 3.00 thanks to Edgewize!

New in version 3.00:
Correct parsing in quotes, private messages etc.

Okay, this is the famous /me code first created by Chen. All credits go to him. I'm just putting up instructions on how to do this in vB3. It's very easy.

Typing "/me is great!" gives you this:

* Erwin is great!


You make changes to THREE php files only.

1. Copy this piece of code:

Change "red" to whatever color you want.

PHP Code:
// /me hack
if (THIS_SCRIPT == 'newreply' && !isset($bbcode) && isset($pagetext))
        
$pagetext preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim''$1* '.$postinfo['username'].' $3'$pagetext);
elseif (
THIS_SCRIPT == 'private' && !isset($bbcode) && isset($pagetext))
        
$pagetext preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim''$1* '.$pm['fromusername'].' $3'$pagetext);
elseif (isset(
$bbcode) && $dobbcode && is_array($GLOBALS['post']))
        
$bbcode preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim''$1* '.$GLOBALS['post']['username'].' $3'$bbcode);
elseif (isset(
$bbcode) && $dobbcode && $GLOBALS['previewpost'])
        
$bbcode preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim''$1* '.$GLOBALS['bbuserinfo']['username'].' $3'$bbcode);
elseif (isset(
$bbcode) && $dobbcode && isset($GLOBALS['fromuserinfo']))
        
$bbcode preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim''$1* '.$GLOBALS['fromuserinfo']['username'].' $3'$bbcode);
// /me hack 
2. Open functions_bbcodeparse.php:

Find:

PHP Code:
// end smilies 
PASTE code copied BELOW.

3. Open newreply.php

Find:

In 3.0.6 or less:
PHP Code:
$pagetext trim(strip_quotes($pagetext)); 
In 3.0.7:
PHP Code:
$pagetext trim(htmlspecialchars_uni($pagetext)); 
PASTE code copied BELOW.

4. Lastly, open private.php

Find:

PHP Code:
$pagetext trim($pagetext); 
PASTE code copied BELOW.

Done!

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #132  
Old 03-28-2004, 06:55 AM
draculanowaday draculanowaday is offline
 
Join Date: Feb 2004
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks, work well with Vb 3.0 Gold
Reply With Quote
  #133  
Old 03-28-2004, 03:21 PM
Aleksey Aleksey is offline
 
Join Date: Mar 2004
Location: Pennsylvania, USA.
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, just to clearfy, if I put "/me" it will say username of a person who is looking at my post?
Reply With Quote
  #134  
Old 03-28-2004, 03:23 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No it will say:

/me like this hack
Reply With Quote
  #135  
Old 03-28-2004, 09:37 PM
masahiko's Avatar
masahiko masahiko is offline
 
Join Date: Mar 2004
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
Is there a way to have it parse the whole line in the hightlight color when there is the /me code in it no matter where the /me code is in the line? Does that make any sense?
change:
'#^/me(.*)$#im'

to:
'#^(.*)/me(.*)$#im'

change:
$post[username] \\1

to:
\\1 $post[username] \\2

change:
$originalposter \\1

to:
\\1 $originalposter \\2

in all the preg_replace() calls and it should do what you want.

this text that /me typed

would come out as:

* this text that masahiko typed

make sense? of course, i haven't used the hack_me.php version so all my example chages are based of the original/my own.
Reply With Quote
  #136  
Old 03-29-2004, 07:29 AM
Bernd Glasstett's Avatar
Bernd Glasstett Bernd Glasstett is offline
 
Join Date: Sep 2002
Location: Waldshut-Tiengen Germany
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, we had a major issue now with the file-version of this hack (where the file is included). Some threads where no longer readable, especially some with an URL in it. We took the hack out and everything went fine again.

My guess is that some of the preg_replace's are not defined clear enough.
Reply With Quote
  #137  
Old 03-29-2004, 08:39 AM
ChuanSE's Avatar
ChuanSE ChuanSE is offline
 
Join Date: Feb 2003
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

strange, i just got 5 identical mails of the latest post in this thread?
Am i the only one?
Reply With Quote
  #138  
Old 03-29-2004, 08:50 AM
Frugal Frugal is offline
 
Join Date: Nov 2001
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bernd Glasstett
Ok, we had a major issue now with the file-version of this hack (where the file is included). Some threads where no longer readable, especially some with an URL in it. We took the hack out and everything went fine again.

My guess is that some of the preg_replace's are not defined clear enough.
Yup this is exactly what happened on my site.

Frugal
Reply With Quote
  #139  
Old 03-29-2004, 09:17 AM
ChuanSE's Avatar
ChuanSE ChuanSE is offline
 
Join Date: Feb 2003
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't say i have these probs at my board tho

the hack works fine, the url's are fine

sure you guyz didn't messed up some code somewhere?
Reply With Quote
  #140  
Old 03-29-2004, 09:19 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by masahiko
Thanks for this great little hack. Below is what I used to get it working on 3.0 Gold (replaces the original post). This code works with PMs as well, and uses the same formatting as the "highlight" tag so it can be used on a per-style basis.

The major difference is the editing of private.php in two spots. I know using $post in private.php probably isn't the best way to go about it, but it is quick and only takes two lines.

code is updated, bug in WYSIWYG mode when editing posts is fixed.

includes/functions_bbcodeparse.php

Find:

PHP Code:
    // ********************* PARSE BBCODE TAGS *************************** 
ABOVE, ADD:

PHP Code:
        // /me Hack 
                
global $post
                
$bbcode preg_replace('#^/me (.*)$#im'"<div><span class="highlight">* $post[username] \\1</span></div>"$bbcode);
        
// /me Hack 

newreply.php

Find:

PHP Code:
                $pagetext trim(strip_quotes($pagetext)); 
UNDERNEATH, ADD:

PHP Code:
                // /me Hack
                
$pagetext preg_replace('#^/me(.*)$#im'"[highlight]* $originalposter\\1[/highlight]"$pagetext); 
                
// /me Hack 


private.php

Find:

PHP Code:
                                // quote reply
                                
$originalposter fetch_quote_username($pm['fromusername']); 
UNDERNEATH, ADD:

PHP Code:
                                // /me Hack
                                        
$pm['message'] = preg_replace('#^/me(.*)$#im'"[highlight]* $originalposter\\1[/highlight]"$pm['message']); 
                                
// /me Hack 
Find:

PHP Code:
        $pm['message'] = parse_pm_bbcode($pm['message'], $pm['allowsmilie']); 
ABOVE IT, ADD:

PHP Code:
        // /me Hack
        
global $post;
        
$post[username] = $pm[fromusername];
        
// /me Hack 
This doesn't seem to working when previewing a PM and doesn't work in the show_pm. It works great in the quote pm, though. Also, if I use other fonts for this, it doesn't seem to work. The link below will show you the testing thread for this.

http://www.bearfacts2.com/forums/showthread.php?t=437

Any idea how to fix the pm stuff and the different font stuff?
Reply With Quote
  #141  
Old 03-29-2004, 10:05 AM
Frugal Frugal is offline
 
Join Date: Nov 2001
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ChuanSE
I can't say i have these probs at my board tho

the hack works fine, the url's are fine

sure you guyz didn't messed up some code somewhere?
Unlikely, I am pretty experienced at this and have been installing hacks since UBB v1 (so about 4 years experience and countless hacks installed during those years), also this hack is one of the simpler hacks, 1 line pasted into 3 files and one php page created by copying and pasting, not much to mess up and very easy to check.

As far as I can tell the problem is related to url's with /me in them (could just be coincidence though, also all the problem posts on my site had urls using vB code rather than just being parsed ie HERE as opposed to http://www.redfoxdk.com/falcon/falcon_downloads/Rattys_missileFix%20_BMSdatav1.61.zip), although I suspect it could also be caused by a conflict between 2 hacks. Chances are Bernd Glasstett and myself both have the conflicting hack.

Mind you it is also possible that the problem is just hard to notice because it only affects a small number of posts. I have 1500 posts per day on my forum and only found 4 recent posts that wouldn't open. I notice that both Bernd and myself have very busy forums whilst those who have stated they are not experiencing the problem have fairly quiet forums.

This could simply be a timebomb waiting to happen on your forum.

Frugal
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06607 seconds
  • Memory Usage 2,358KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (13)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete