vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   [you] hack (https://vborg.vbsupport.ru/showthread.php?t=60633)

djnoz 01-24-2004 08:55 AM

In case anyone asks, to make it work for [ you ] instead, replace the appropriate line with this:

PHP Code:

    $replacementvars['/\[you\]/i'] = $bbuserinfo['username']; 


fly 01-24-2004 11:08 AM

Thanks guys!!!

I know I may be getting picky now but...

In the vB2 version I had, the [you] code was left in the reply. This made it easy to see if someone typed really your name, or used the [you] code. In this version, the [you] code is replaced w/ my name in the reply. Anyway to keep the [you] in there when replying instead?

Did that even make sense? Previously, when hitting reply, one could see if a person was really talking to you or using the [you] code.

djnoz 01-24-2004 02:15 PM

If you wanted to do this, it would require removal of the original [ you ] hack and modifications to the bbcodeparse php file. However, the you hack would no longer work in thread titles if you did this. If you want people to know the difference, you could try formatting... eg:

$replacementvars['/\[you\]/i'] = "<i>$bbuserinfo['username']</i>";

or something

BTW, NTLDR, thanks for sharing. It was quite a fun prank =)

Link14716 01-24-2004 02:18 PM

Quote:

Originally Posted by flypaper
Thanks guys!!!

I know I may be getting picky now but...

In the vB2 version I had, the [you] code was left in the reply. This made it easy to see if someone typed really your name, or used the [you] code. In this version, the [you] code is replaced w/ my name in the reply. Anyway to keep the [you] in there when replying instead?

Did that even make sense? Previously, when hitting reply, one could see if a person was really talking to you or using the [you] code.

Try this.
Find:
PHP Code:

    $replacementvars['/{bbusername}/i'] = $bbuserinfo['username']; 

Replace with:
PHP Code:

    if (THIS_SCRIPT != "editpost") {
        
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username']; 
    } 

EDIT: I just tested it and it works perfectly.

fly 01-24-2004 03:28 PM

Link: I don't think that worked, but it may be because I can't explain it.

Is it possible that when someone quotes another person, they see the [you] in the quote instead of their own name?

EDIT: and it looks like it only works in the thread title once. When I post a thread, my name is in the title. Other users only see my name too.

Boofo 01-24-2004 06:37 PM

Quote:

Originally Posted by assassingod
Try using:
PHP Code:

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // ! MicroStats Hack for vB 3.0 Gamma By: Apoco !
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
function process_replacement_vars($newtext$sendheader 1)
    {
    
// parses replacement vars
    
global $DB_site$vboptions$style$stylevar$newpmmsg$_SERVER$microstats$bbuserinfo;
    if (
connection_status())
    {
    exit;
    }
    
// do vBulletin 3 replacement variables
    
if (!empty($style['replacements']))
    {
    if (!isset(
$replacementvars))
    {
    
$replacementvars unserialize($style['replacements']);
    }
        
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username']; 
    
// this is WAY too slow!
    //$newtext = strtr($newtext, $replacementvars);
    // using str_replace() has case-sensitivity issues...
    //$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
    // this is slower than str_replace() but is case-insensitive, so we'll use it.
    
$newtext preg_replace(array_keys($replacementvars), $replacementvars$newtext);
    }
    
$newtext str_replace(('{microstats}'), $microstats$newtext);
    
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
return $newtext;
    } 


Thanks, Steve. I ended up going with this and it seems to work. ;)

PHP Code:

 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !  MicroStats Hack for vB 3.0 Gamma By: Apoco   !
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function process_replacement_vars($newtext$sendheader 1)
{
 
// parses replacement vars
 
global $DB_site$vboptions$style$stylevar$newpmmsg$_SERVER$microstats$bbuserinfo;
 static 
$replacementvars;
 if (
connection_status())
 {
  exit;
 }
 
// do vBulletin 3 replacement variables
  
if (!isset($replacementvars))
  {
   
$replacementvars unserialize($style['replacements']);
  }
   
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username'];
  
// this is WAY too slow!
  //$newtext = strtr($newtext, $replacementvars);
  // using str_replace() has case-sensitivity issues...
  //$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
  // this is slower than str_replace() but is case-insensitive, so we'll use it.
  
$newtext preg_replace(array_keys($replacementvars), $replacementvars$newtext);

$newtext str_replace(('{microstats}'), $microstats$newtext);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
return $newtext;



Boofo 01-24-2004 06:56 PM

Quote:

Originally Posted by flypaper
Link: I don't think that worked, but it may be because I can't explain it.

Is it possible that when someone quotes another person, they see the [you] in the quote instead of their own name?

EDIT: and it looks like it only works in the thread title once. When I post a thread, my name is in the title. Other users only see my name too.

I just tried it and the title goes with whoever is looking at the thread on my site. I posted 2 messages in there and logged out and viewed the thread as Unregistered and that is what showsed up in both mesages and the thread title.

NTLDR 01-24-2004 07:03 PM

It should replace it on any page, anywhere as long as the page goes through process_replacement_vars(), which all the main vB (forum) pages that output something do.

@flypaper, I'm a bit confused as to how you'd like this to work.

Boofo 01-24-2004 07:23 PM

Anyway to fix it so you won't see {bbusername} in the email that gets sent if you are subscribed to the thread? ;)

NTLDR 01-24-2004 07:46 PM

Untested as usual, in includes/functions.php find:

PHP Code:

$touser['languageid'] = iif($touser['languageid'] == 0$vboptions['languageid'], $touser['languageid']); 

Add after:

PHP Code:

        $temptext $pagetext;
        
$pagetext preg_replace('/{bbusername}/i'$touser['username'], $pagetext); 

Find:

PHP Code:

vbmail($touser['email'], $subject$message); 

Add after:

PHP Code:

$pagetext $temptext



All times are GMT. The time now is 12:33 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01102 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete