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)

wrongful 01-23-2004 04:28 PM

[you] hack
 
Is there a chance of someone being able to port over this hack or the original author doing it. Also maybe with the option to limit its use by usergroup.

https://vborg.vbsupport.ru/showthrea...8&page=1&pp=15

fly 01-23-2004 04:52 PM

LOL. Weird. I was just coming here to request that.

NTLDR 01-23-2004 08:02 PM

In includes/functions.php find:

PHP Code:

    // do vBulletin 3 replacement variables
    
if (!empty($style['replacements']))
    {
        if (!isset(
$replacementvars))
        {
            
$replacementvars unserialize($style['replacements']);
        }

        
// 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);
    }

    return 
$newtext

Replace with:

PHP Code:

    // do vBulletin 3 replacement variables
    
if (!isset($replacementvars))
    {
        
$replacementvars unserialize($style['replacements']);
    }
    global 
$bbuserinfo;
    
$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);

    return 
$newtext

Then use {bbusername} in your posts etc

wrongful 01-23-2004 09:03 PM

Great! Thank You.

eXtremeTim 01-23-2004 09:59 PM

Thanks saved me the trouble of making it :)

eXtremeTim 01-23-2004 10:09 PM

Now anyway so you can edit a post and it not get all screwed up? As in not lock in your username instead of {bbusername}

Boofo 01-24-2004 03:14 AM

Where will this all work at? Just in posts? Any way to get it to work in thread titles, too?

wrongful 01-24-2004 03:25 AM

Quote:

Originally Posted by Boofo
Where will this all work at? Just in posts? Any way to get it to work in thread titles, too?

It does work in thread titles too

Boofo 01-24-2004 03:43 AM

Great! How about the seach page? ;)


NTLDR, how would I add this code to this? It has the microstats hack in it.

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ! 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;
static $replacementvars;
if (connection_status())
{
exit;
}
// do vBulletin 3 replacement variables
if (!empty($style['replacements']))
{
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
// 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;
}

assassingod 01-24-2004 08:07 AM

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;
    } 


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


Boofo 01-24-2004 11:10 PM

I can't find any of the code you said to search for in the functions.php.

EDIT: I found the code in functions_newpost.php. It seems to work except for the thread title in the message and the Subject of the message. Can those be fixed?

fly 01-25-2004 10:40 AM

Quote:

Originally Posted by NTLDR
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.

Lemme do an example and tell me if this can be done w/ vb3...

(original post with [you] hack): flypaper is cool.

(post quoted for reply w/ current hack): flypaper is cool.

(post quoted for reply w/ vb2 hack): [you] is cool.

Personally, I think it works better if the [you] code shows up in the quoted post. Hopefully, that makes sense now. Either way, I really appreciate the help.

Boofo 01-25-2004 10:50 AM

Quote:

Originally Posted by flypaper
Lemme do an example and tell me if this can be done w/ vb3...

(original post with [you] hack): flypaper is cool.

(post quoted for reply w/ current hack): flypaper is cool.

(post quoted for reply w/ vb2 hack): [you] is cool.

Personally, I think it works better if the [you] code shows up in the quoted post. Hopefully, that makes sense now. Either way, I really appreciate the help.

That would be ok if it only showed up as [you] for the Admins and Mods. Otherwise, once everyone on the forum sees what the code is to do it, then you have everyone doing it and it gets old really quick. It kills it basically. On my site, once I get the thread title and subject of the email notifications taken care of, I am going to change the word for the hack to something no one will figure out so it won't get abused on the site. ;)

NTLDR 01-25-2004 04:30 PM

@Boofo, sorry I meant functions_newpost.php ;)

For the [you] part I think he means [you] appears and isn't the next to get the username.

To fix thread titles, find again in functions_newpost.php:

PHP Code:

$threadinfo['title'] = unhtmlspecialchars($threadinfo['title']); 

Add after:
PHP Code:

$temptitle =  $threadinfo['title']; 

Find: (you added this code from the above instructions)

PHP Code:

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

Add after:

PHP Code:

$threadinfo['title'] = preg_replace('/{bbusername}/i'$touser['username'], $threadinfo['title']); 

Find (again you added this from the above posts instructions):

PHP Code:

$pagetext $temptext

Add after:

PHP Code:

$threadinfo['title'] = $temptitle 

To get [you] working as I think you want it too, try this it should work:

in newreply.php find:

PHP Code:

$pagetext htmlspecialchars_uni($postinfo['pagetext']); 

Add before:

PHP Code:

$pagetext =  preg_replace('/{bbusername}/i''\[you\]'$pagetext); 


Boofo 01-25-2004 07:01 PM

This:

PHP Code:

$threadinfo['title'] = $temptitle 

is supposed to have a semi-colon after it, right? ;)

Also, I put this:

PHP Code:

$temptitle $threadinfo['title']; 

AFTER the 2nd instance of this:

PHP Code:

$threadinfo['title'] = unhtmlspecialchars($threadinfo['title']); 

since it shows in 2 places in the file. Is it in the right place now?

NTLDR 01-25-2004 09:03 PM

Yes and yes ;)

Boofo 01-26-2004 12:12 AM

Thank you and thank you, sir. ;)

fly 01-26-2004 12:27 PM

Quote:

Originally Posted by Boofo
That would be ok if it only showed up as [you] for the Admins and Mods. Otherwise, once everyone on the forum sees what the code is to do it, then you have everyone doing it and it gets old really quick. It kills it basically. On my site, once I get the thread title and subject of the email notifications taken care of, I am going to change the word for the hack to something no one will figure out so it won't get abused on the site. ;)

LOL

I enjoy watching my users abuse the n00bs. That's fun to me.

Boofo 01-26-2004 08:58 PM

Quote:

Originally Posted by flypaper
LOL

I enjoy watching my users abuse the n00bs. That's fun to me.

Did the [you] code NTLDR post for you work like you wanted it to?

Boofo 01-27-2004 12:15 AM

NTLDR, one last area. Can we get this to work for the forum names in the archive display?

NTLDR 01-27-2004 10:25 AM

That would require a fair bit of modding has none of the archive is passed through the replacement vars function. If I get time I'll take a look.

fly 01-27-2004 10:30 AM

Quote:

Originally Posted by Boofo
Did the [you] code NTLDR post for you work like you wanted it to?

I thought he was replying to you. I'm confused.

Boofo 01-27-2004 11:54 AM

Quote:

Originally Posted by NTLDR
That would require a fair bit of modding has none of the archive is passed through the replacement vars function. If I get time I'll take a look.

I got it all to work except one place. It is the navbar right after you click on a forum that has the [you] code in it. Everywhere else in the archive it works great. ;)

Beermonster 03-05-2004 05:12 PM

Thanks guy's I love this hack it's got to be the funniest ever

Primeval 03-18-2006 05:15 AM

Any chance for someone to make this work on 3.0.9 ?

I just tested the code and it gave me a parse error from somewhere else.


All times are GMT. The time now is 05:36 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.01511 seconds
  • Memory Usage 1,889KB
  • 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
  • (23)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete