Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

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
  #152  
Old 04-14-2004, 02:45 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 Edgewize
If anyone is having trouble with my original hack_me.php version posted a few pages back, then I'm at a loss. It must be a conflict with another poorly written hack because all that my code does is insert code tags before and after the /me line, as if they were typed by the user himself. There is no way that vB tags can cause a post or a thread to just 'disappear' unless some custom change has been made to the bbcode parser.

For the record, the original hack_me version that I posted in this thread works fine for my vB 3.0 Gold sites.
I went back to using your code. I couldn't get any of the others to work everywhere.
Reply With Quote
  #153  
Old 04-14-2004, 03:08 PM
Edgewize Edgewize is offline
 
Join Date: Jan 2004
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oops, right after I say that, I discover a problem New version fixes a very obscure bug with one-line quotes. Just a minor display bug, could accidentally change the color of text that came right before a /me. Check the original post:

https://vborg.vbsupport.ru/showthrea...334#post484334
Reply With Quote
  #154  
Old 04-14-2004, 04:26 PM
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 Edgewize
Oops, right after I say that, I discover a problem New version fixes a very obscure bug with one-line quotes. Just a minor display bug, could accidentally change the color of text that came right before a /me. Check the original post:

https://vborg.vbsupport.ru/showthrea...334#post484334
What did you change in it? I see the s is gone and a t is added. Anything else?

And I wanted to ask. How come if I use highlight instead of color=, all the /me lines are in bold?
Reply With Quote
  #155  
Old 04-16-2004, 06:12 AM
Edgewize Edgewize is offline
 
Join Date: Jan 2004
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All the occurrances of \s were replaced with [ \t] (that's [(space)\t]). \s also matches newlines, so that could get into trouble and match too much in very particular situations. Also, the parenthesis groups were shifted around a bit, but I can't remember why

I have no idea why highlight would do that. As you can see, it just inserts a tag before any bbcode processing is done ... does your highlight normally make things bold?
Reply With Quote
  #156  
Old 04-16-2004, 01:39 PM
Wolf42's Avatar
Wolf42 Wolf42 is offline
 
Join Date: Nov 2001
Location: Vienna, Austria, Europe
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[high]* Wolf42 clicks install
[/high]

Its still a nice hack. Thank you very much.
Reply With Quote
  #157  
Old 04-16-2004, 03:06 PM
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 Edgewize
All the occurrances of \s were replaced with [ \t] (that's [(space)\t]). \s also matches newlines, so that could get into trouble and match too much in very particular situations. Also, the parenthesis groups were shifted around a bit, but I can't remember why

I have no idea why highlight would do that. As you can see, it just inserts a tag before any bbcode processing is done ... does your highlight normally make things bold?
To tell you the truth, I'm not sure if the highlight tags does that also, or not. I never paid much attention to it until now. Where would that code be on vB3, do you know?
Reply With Quote
  #158  
Old 04-17-2004, 09:32 PM
TouchingVirus's Avatar
TouchingVirus TouchingVirus is offline
 
Join Date: Nov 2001
Location: Bogland
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The highlight code appears in functions_bbcode.php at line 203..i think this is what you were looking for..

PHP Code:
// [HIGHLIGHT]
    
$bbcodes['custom']['find']['[highlight]'] = '#\[highlight\](.*)\[/highlight\]#esiU';
    
$bbcodes['custom']['replace']['[highlight]'] = "handle_bbcode_parameter('\\1', '" str_replace("'""\'"'<span class="highlight">\1</span>') . "')";
    
$bbcodes['custom']['recurse']['highlight'][0] = array('replace_html' => "<span class=\"highlight\">\\7</span>"); 
Reply With Quote
  #159  
Old 04-17-2004, 09: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

Why would it be in bold when I use it with this hack? Any idea?
Reply With Quote
  #160  
Old 04-18-2004, 09:20 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok i've enhanced this code for the benefit of sites with multiple stylesets (conflicting colours)

1. Open includes/functions_bbcodeparse.php:

Find:

PHP Code:
         $bbcode str_replace(array('&gt;|||)''&lt;|||)''&quot;|||)'), array('&gt;)''&lt;)','&quot;)'), $bbcode);
     } 
// end smilies 
UNDERNEATH, ADD:

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

2. Open newreply.php:

Find:

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

PHP Code:
 // /me Hack
                 
$pagetext preg_replace('#^/me(.*)$#im'"* $originalposter\\1"$pagetext);
 
// /me Hack 
Done and you also maintain XHTML compliancy
Reply With Quote
  #161  
Old 04-19-2004, 12:53 PM
SySt3M SySt3M is offline
 
Join Date: Aug 2002
Location: UK
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks very much, nifty little addition this one

/me clicks install
Reply With Quote
Reply

Thread Tools

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 02:23 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.12849 seconds
  • Memory Usage 2,345KB
  • 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
  • (10)bbcode_php
  • (3)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