Mở sources/lib/modfunctions.php
Tìm:
CODE
$topics = array();
Thêm phía dưới:
CODE
$author_id = array();
$num_to_del = array();
/*--------------
Tìm:
CODE
$DB->simple_construct( array( 'select' => 'pid, topic_id', 'from' => 'posts', 'where' => 'pid'.$pid ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$posts[ $r['pid'] ] = $r['topic_id'];
$topics[ $r['topic_id'] ] = 1;
}
Thay bằng:
CODE
$DB->simple_construct( array( 'select' => 'author_id, pid, topic_id', 'from' => 'posts', 'where' => 'pid'.$pid ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$posts[ $r['pid'] ] = $r['topic_id'];
$topics[ $r['topic_id'] ] = 1;
$author_id[$r['author_id']]++;
}
Tìm:
CODE
//-----------------------------------------
// Update the stats
//-----------------------------------------
Thêm phía dưới:
CODE
if ($this->forum['inc_postcount'])
{
if ( count($author_id) > 0 )
{
foreach ($author_id as $member_id => $posts_to_del)
{
$num_to_del[$posts_to_del] .= $member_id." ";
}
foreach ($num_to_del as $num => $auth)
{
$authorids = " IN(".implode( ",", explode (" ", rtrim ($auth)) ).")";
$DB->simple_exec_query( array( 'update' => 'members',
'set' => "posts = posts - ".$num,
'where' => "id{$authorids}") );
}
}
}
Tìm:
CODE
$attach = array();
Thêm phía dưới:
CODE
$author_id = array();
$num_to_del = array();
Tìm:
CODE
$DB->simple_construct( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id".$tid ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$posts[] = $r['pid'];
}
Thay bằng:
CODE
$DB->simple_construct( array( 'select' => 'author_id, pid', 'from' => 'posts', 'where' => "topic_id".$tid ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$posts[] = $r['pid'];
$author_id[$r['author_id']]++;
}
if ($this->forum['inc_postcount'])
{
if ( count($author_id) > 0 )
{
foreach ($author_id as $member_id => $posts_to_del)
{
$num_to_del[$posts_to_del] .= $member_id." ";
}
foreach ($num_to_del as $num => $auth)
{
$authorids = " IN(".implode( ",", explode (" ", rtrim ($auth)) ).")";
$DB->simple_exec_query( array( 'update' => 'members',
'set' => "posts = posts - ".$num,
'where' => "id{$authorids}") );
}
}
}
Done!!!