Version: 1.00, by Boofo
Developer Last Online: Jun 2012
Version: 3.0.0
Rating:
Released: 03-19-2004
Last Update: Never
Installs: 59
No support by the author.
vB3 [you] Code Hack
Version 1.1
(By Boofo)
What does this hack do?
This hack will take the [you] code and replace it with the user's name who is veiwing the thread, forum or archive on your site.
Credits:
A big thanks goes out to Mutt for his original idea and version of this hack for vB2. I would also like to thank NTLDR for his invaluable help with the main core of this code.
Version Information:
Version 1.0 --Initial release
Version 1.1 --Fixed bug where the archive/global.php code would not parse until $bbuserinfo was added to the global statement.
Installation overview: Files to edit: (4)
--includes/functions.php
--includes/functions_newpost.php
--archive/index.php
--archive/global.php
NOTE: Support will only be provided to those who click the install button.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
You'd better check to make sure that is going to work everywhere. I was going to do it that way in my version but there were too many places that you can't catch with the way you are doing it.
I've actually got similar code to that at the moment but it doesn't work on thread titles.
Mine works on thread, forum and archive titles. True, I haven't updated it for 3.0.3 yet as I am not running that version and don't plan to upgrade until new versions stop coming out so frequently.
I used the following code in functions.php instead of the code you provided.
PHP Code:
if (THIS_SCRIPT != editpost) {
global $bbuserinfo;
$replacementvars['/\[you\]/i'] = $bbuserinfo['username'];
}
$replacementvars['/\[test\]/i'] = "This is just a test.";
Reason I did this is so that its not parsed on editpost so that when you edit a post that contains it you dont have that nice problem of it locking in on your name. Also so you can tell when other users are using it faster and easier. The reason for the [test] code is since that it will allways be looking for something to parse out so on edit post you would get an error becuase there would be nothing to parse out since the error checking code was removed when this hack was installed.
I used the following code in functions.php instead of the code you provided.
PHP Code:
if (THIS_SCRIPT != editpost) { global $bbuserinfo; $replacementvars['/\[you\]/i'] = $bbuserinfo['username'];
} $replacementvars['/\[test\]/i'] = "This is just a test.";
Reason I did this is so that its not parsed on editpost so that when you edit a post that contains it you dont have that nice problem of it locking in on your name. Also so you can tell when other users are using it faster and easier. The reason for the [test] code is since that it will allways be looking for something to parse out so on edit post you would get an error becuase there would be nothing to parse out since the error checking code was removed when this hack was installed.
Exactly what part of the code did you replace with this in functions.php? There is a big block of code there.
If you have the hack installed replace the following with the code I posted above:
PHP Code:
global $bbuserinfo;
$replacementvars['/\[you\]/i'] = $bbuserinfo['username'];
If you are doing a fresh install replace the following
PHP Code:
function process_replacement_vars($newtext, $sendheader = 1)
{
// parses replacement vars
global $DB_site, $vboptions, $style, $stylevar, $newpmmsg, $_SERVER, $debug;
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);
}
return $newtext;
}
with
PHP Code:
function process_replacement_vars($newtext, $sendheader = 1)
{
// parses replacement vars
global $DB_site, $vboptions, $style, $stylevar, $newpmmsg, $_SERVER, $debug;
static $replacementvars;
if (connection_status())
{
exit;
}
// do vBulletin 3 replacement variables
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
if (THIS_SCRIPT != editpost) {
global $bbuserinfo;
$replacementvars['/\[you\]/i'] = $bbuserinfo['username'];
}
$replacementvars['/\[test\]/i'] = "This is just a test.";
// 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);