| Code:
|
##
##----------[ OPEN ]-------------------------------------
##
viewtopic.php
##
##----------[ FIND ]-------------------------------------
##
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql);
}
##
##----------[ REPLACE WITH ]-----------------------------
##
/*-------------------------------------------------------------------
// Disable Poster View Counting - Begin ORIGINAL phpBB Code
//
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql);
}
//
// Disable Poster View Counting - End ORIGINAL phpBB Code
//-------------------------------------------------------------------*/
//-------------------------------------------------------------------
// Disable Poster View Counting - Begin Code Addition
//
$sql = 'SELECT poster_id FROM ' . POSTS_TABLE . '
WHERE topic_id = ' . $topic_id . '
AND poster_id <> ' . ANONYMOUS;
if ( $posters_result = $db->sql_query($sql) )
{
$authors = array();
while( $posters = $db->sql_fetchrow($posters_result) )
{
$authors[] = intval($posters['poster_id']);
}
if ( $userdata['user_id'] == ANONYMOUS || !in_array($userdata['user_id'], $authors) )
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update topic views.', '', __LINE__, __FILE__, $sql);
}
}
}
else
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql);
}
}
//
// Disable Poster View Counting - End Code Addition
//-------------------------------------------------------------------
|