1 頁 (共 1 頁)

[外掛]Stop Author View Increase( 檢視自己發表的文章時不增加文章的觀看次數)

發表於 : 2006-10-08 , 15:40
yehrussell
[外掛]Stop Author View Increase

http://phpbb-tw.net/phpbb/viewtopic.php?t=21396

--------------------------------------------------------------------------------

[php:1:29cdbc21f1]

代碼: 選擇全部

############################################################## 
## MOD Title: Stop Author View Increase 
## MOD Author: DanielT < savi.mods@danielt.com > (Daniel Taylor) http://www.danielt.com 
## MOD Description: Does not increase viewed count when author is viewing his/her own topic 
## MOD Version: 1.0.1 
## 
## Installation Level: easy 
## Installation Time: ~1 Minutes 
## Files To Edit: viewtopic.php 
## Included Files: n/a 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: n/a 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ 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 ]------------------------------------------ 
# 
if (!($postrow[0]['user_id'] == $userdata['user_id'])) { 

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

} 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM[/php:1:29cdbc21f1] 
來源:phpbb 官方網站
翻譯:不需要
功能:當作者檢視自己發表的文章時不增加文章的觀看次數