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
  #122  
Old 03-27-2004, 12:37 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have it set for 20,000 characters. How long was the post?
Reply With Quote
  #123  
Old 03-27-2004, 12:39 PM
Frugal Frugal is offline
 
Join Date: Nov 2001
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
I have it set for 20,000 characters. How long was the post?
About 27000 characters.

Frugal
Reply With Quote
  #124  
Old 03-27-2004, 12:41 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll up it to 50 k and then you can try it again. Give me 5 minutes.
Reply With Quote
  #125  
Old 03-27-2004, 07:38 PM
masahiko's Avatar
masahiko masahiko is offline
 
Join Date: Mar 2004
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
code is updated, bug in pm previews is fixed see the funcitons_newpost changes.

includes/functions_newpost.php

Find:

PHP Code:
        $previewmessage parse_bbcode($newpost['message'], $foruminfo['forumid'], iif($newpost['disablesmilies'], 01)); 
ABOVE, ADD:

PHP Code:
        // /me hack
        
global $post;
        
$post[username] = $bbuserinfo[username];
        
// /me hack 

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 
Reply With Quote
  #126  
Old 03-27-2004, 07:40 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about the editpost.php?
Reply With Quote
  #127  
Old 03-27-2004, 07:43 PM
masahiko's Avatar
masahiko masahiko is offline
 
Join Date: Mar 2004
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
What about the editpost.php?
i haven't had any issues with editing posts. were there problems with it?
Reply With Quote
  #128  
Old 03-27-2004, 07:49 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know. I use the hack_me.php file, but I thought when editing posts there might be a problem so I just thought I would mention it.

Is there a way to make the whole line parse if there is bbcode BEFORE the /me code? They had that with an addon for the vB2 /me code.
Reply With Quote
  #129  
Old 03-27-2004, 08:08 PM
msimplay's Avatar
msimplay msimplay is offline
 
Join Date: Aug 2002
Location: UK
Posts: 1,059
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i prefer hack_me.php works perfectly in vb3 gold
Reply With Quote
  #130  
Old 03-27-2004, 08:13 PM
masahiko's Avatar
masahiko masahiko is offline
 
Join Date: Mar 2004
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
I don't know. I use the hack_me.php file, but I thought when editing posts there might be a problem so I just thought I would mention it.
i figured out where people where having the problem. the code i posted is updated to fix it.

Quote:
Originally Posted by Boofo
Is there a way to make the whole line parse if there is bbcode BEFORE the /me code? They had that with an addon for the vB2 /me code.
changing '#^/me(.*)$#im' to '#/me(.*)$#im' in all the preg_replace() calls should let it start anywhere inside the line and end at the end of the line.
Reply With Quote
  #131  
Old 03-27-2004, 08:48 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
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 12:39 AM.


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.13514 seconds
  • Memory Usage 2,356KB
  • 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
  • (15)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