PDA

View Full Version : Reply Count addon for "In Reply to" hack by WetWired


amykhar
11 Dec 2004, 17:20
Original hack can be found here:

http://www.vbulletin.org/forum/showthread.php?p=475956#post475956

What my addon does is to place an incremental number in the "Re:" section of the post title.

For example, if I posted a post called "Test Post", the first reply would be "Re(1): Test Post". The second would be "Re (2): Test Post" and so on.

If a reply is made to "Re (1): Test Post", that reply becomes "Re (2) : Test Post"
First, install the WetWired's hack. Then,

In includes/functions_newpost.php Find the function fetch_quote_title

Replace the entire function with:


// ###################### Start fetch_quote_title #######################
// checks the parent post and thread for a title to fill the default title field
function fetch_quote_title($parentposttitle, $threadtitle)
{
global $vboptions, $vbphrase;

if ($vboptions['quotetitle'])
{
if ($parentposttitle != '')
{
$posttitle = $parentposttitle;
}
else
{
$posttitle = $threadtitle;
}
$posttitle = unhtmlspecialchars($posttitle);
if(strstr($posttitle, "Re:"))
{
list($prefix,$remainder) = split("\(",$posttitle,2);
list ($number,$newtitle) = split("\)",$remainder,2);
$posttitle = "Re: (". ($number+1) . ") ". $newtitle;
}
else {
$posttitle = "Re:(1)" . $posttitle;
}

//$posttitle = preg_replace('#^(' . preg_quote($vbphrase['reply_prefix'], '#') . '\s*)+#i', '', $posttitle);
return "$posttitle";
}
else
{
return '';
}
}


in newreply.php find:

$newpost['title'] = $_POST['title'];


Add after:

if (!$newpost['title'])
{
$newpost['title'] = $postinfo['title'];
$newpost['title']=fetch_quote_title($newpost['title'], $threadinfo['title']);
}


Done.