[外掛]在個人資料裡顯示人氣指數

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
Martinet
竹貓忠實會員
竹貓忠實會員
文章: 850
註冊時間: 2003-06-09 21:58
聯繫:

[外掛]在個人資料裡顯示人氣指數

文章 Martinet »

########################################################
## Mod Title: 在個人資料裡顯示人氣指數\r
## Mod Version: 1.0
## Mod Date: 2003 11月 4日
##
## By: Martinet Oaf < oafwork@hotmail.com >
##
## Description:
## 需搭配OOHOO的人氣指數使用
##
#
## Installation Level: 簡單
## Installation Time: 1 分鐘不到 ^^"
## Files To Edit: 2
## Included Files: (NONE)
##
########################################################
## Author Notes:
## 我的站 : http://oafwork.sytes.net/letstalk/
## Demo : 同上^^"
########################################################

#######打開 includes/usercp_viewprofile.php#########

#######找到#######

代碼: 選擇全部

//
// Generate page
#######在上面加上###########

代碼: 選擇全部

//在viewprofile裡顯示人氣指數 By Martinet Oaf~~


      $tsql = "SELECT COUNT(topic_id) AS count_topics, " . 
             "SUM(topic_replies) AS sum_topic_replies, " . 
             "SUM(topic_views) AS sum_topic_views " . 
             "FROM " . TOPICS_TABLE . " " . 
             "WHERE topic_poster = " . $u; 
	//echo"$sql"; // DEBUG用\r
                $result = $db->sql_query($tsql); 
                $rr_row = $db->sql_fetchrow($result); 
  
                // 發表的主題總數 
                $count_topics = $rr_row['count_topics']; 
  
                // 所有主題的回應總數 
                $sum_topic_replies = $rr_row['sum_topic_replies']; 
  
                // 主題人氣(觀看數) 
                $sum_topic_views = $rr_row['sum_topic_views']; 

      $profiledatas = get_userdata($u); 

                // 發文總數 
                $sum_posts = $profiledatas['user_posts']; 

                // 回應文章總數 = 發文總數 - 發表的主題總數 
                $count_replies = $sum_posts - $count_topics; 

                                // 魅力值 = (發表的主題總數*100 + 所有主題的回應總數*5 + 回應文章總數*100 + 主題人氣(觀看數)) / ((發文總數+1)*100) 
      $rr_hack = ($count_topics * 100 + $sum_topic_replies * 5 + $count_replies * 100 + $sum_topic_views) / (($sum_posts+1)*100); 

                // 取小數點後一位 
                $rr_hack = sprintf("%01.2f", $rr_hack); 


//echo"$rr_hack"; //DEBUG用\r


//End 人氣指數顯示\r
#######找到#######

代碼: 選擇全部

'YIM' => $yim,
#######在下面加上########

代碼: 選擇全部

'RR_HACK' => $rr_hack, //人氣指數\r
###########打開templates/your_template/profile_view_body.tpl#############

找到\r

代碼: 選擇全部

<tr> 
	  <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_INTERESTS}:</span></td>
	  <td> <b><span class="gen">{INTERESTS}</span></b></td>
</tr>
###########在下面加上############

代碼: 選擇全部

<tr> 
		  <td valign="top" align="right" nowrap="nowrap"><span class="gen">人氣指數:</span></td>
		  <td> <b><span class="gen">{RR_HACK}</span></b></td>
</tr>
################EOM##############
主題已鎖定

回到「非官方認證外掛」