[外掛精華]虛擬貨幣 for phpBB2.0

與 phpBB 2.0.x 相關主題。

版主: 版主管理群

回覆文章
beowolf
竹貓好朋友
竹貓好朋友
文章: 267
註冊時間: 2002-04-11 21:23
來自: 竹貓東京分局
聯繫:

[外掛精華]虛擬貨幣 for phpBB2.0

文章 beowolf »

用下面的install的方法我剛測試過了,install全新的phpbb2.0.1後直接裝了這個MOD.
沒有什麼大問題, 除了我後端找不到加錢這一欄之後.
(我會找時間請教oohoo老大之後再跟各位報告的)
貨幣本身是沒有問題的..那後端那一部份...就自己來吧..
我不想再花5個小時去找一篇改這個的後端..
一定有說過怎麼改. 你要的話請自己找..

我的建議是慢慢看,慢慢改.. 細心一點就沒有什麼問題了.
既然大家都在用 這個MOD沒有人說有什麼大隻的BUG.
有問題90%一定就是出現在你的身上, 加油~
竹貓星球團隊支持你
##############################################################
## Mod Title: Virtual Money MOD [虛擬貨幣]
## Mod Version: 2.0.1
## Author: OOHOO < webdev@phpbb-tw.net > http://phpbb-tw.net/
##
## Description: Virtual money can encourage registered users to
## participate in the forum activity. By giving the virtual money
## reward, users will allow to use their money in the forum, however,
## this will depond on webmaster's descision.
##
## Note: Only registered users can have virtual money.
##
## Demo: http://phpbb-tw.net/
##
## Installation Level: (medium)
## Installation Time: 5 - 10 Minutes
## Files To Edit: posting.php, includes/functions_post.php,
## includes/usercp_register.php, templates/xxx/profile_add_body.tpl,
## templates/xxx/admin/user_edit_body.tpl, admin/admin_users.php,
## language/ur_lang/lang_main.php, memberlist.php,
## templates/xxx/memberlist_body.tpl
##
## Included Files: (n/a)
##############################################################
##
## Author Note: Feel free to use it, and backup b4 u install it.
## It's just a easy MOD, but if u like it, give credit to me.
##
##############################################################
## Version History:
## 1.x.x for eariler phpBB version
## 2.0.0 for phpBB 2.0.0
## 2.0.1 memberlist include
##############################################################
這個完整的[虛擬貨幣外掛]包含前後端的介面, 修改範圍, 7個檔
posting.php
includes/functions_post.php,
includes/usercp_register.php
templates/xxx/profile_add_body.tpl,
templates/xxx/admin/user_edit_body.tpl
admin/admin_users.php
language/ur_lang/lang_main.php

v2.0.1新增 memberlist
memberlist.php
templates/xxx/memberlist_body.tpl

檢查一下這幾個檔有沒有加過其他的MOD, 如果沒有直接下載v_money_2.0.1.zip
覆蓋原檔即可, 如果已加過別的, 嗯.. 就要麻煩你們自己比對一下了..

v_money_2.0.1.zip裡並未包含lang_main.php, 請直接在lang_main.php的最下方加入
<?php
$lang['Virtual_Money'] = "雷克斯幣"; // Virtual_Money_MOD
$lang['User_Asset'] = "個人資產"; // Virtual_Money_MOD
?>

"雷克斯幣"可以自行改成你要的幣制, 後端管理的部分被包含在會員管理中.

資料庫部分及主題顯示請參照下列步驟:

第一步:
新增資料庫欄位, 執行

代碼: 選擇全部

ALTER TABLE phpbb_users ADD user_money int(11) unsigned NOT NULL default '0'; 
第二步:
編輯 viewtopic.php, 找到這陀..

代碼: 選擇全部

// 
// Go ahead and pull all data for this topic 
// 
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, u.user_allow_viewonline, u.user_session_time, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid 
把 u.user_money 加到 SELECT 裡面, 接著找到這段

代碼: 選擇全部


   $poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ": " . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : ""; 
 
在下面加入

代碼: 選擇全部


   $poster_money = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? ("雷克斯幣: " . $postrow[$i]['user_money']) : ""; // Virtual_Money_MOD by OOHOO 
 
再來找這段

代碼: 選擇全部


      "POSTER_AVATAR" => $poster_avatar, 
 
在下面加入

代碼: 選擇全部


      "POSTER_MONEY" => $poster_money, // Virtual_Money_MOD by OOHOO 
 
viewtopic.php 的修改完成.

第三步:
修改 /templates/subSilver/viewtopic_body.tpl, 找到

代碼: 選擇全部

     {postrow.POSTER_FROM}<br /> 
 
在下面加入

代碼: 選擇全部


     {postrow.POSTER_MONEY}<br /> 
 
位置要自己調整.

接下來修改 posting.php, 找到這陀

代碼: 選擇全部



<?php 
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); 
?> 


 

在最後加上 $reward_sql變數:

代碼: 選擇全部



<?php 
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id, $reward_sql); 
?> 

找到:

代碼: 選擇全部


               if( $mode == "newtopic" ) 
               { 
                  $sql .= ", forum_topics = forum_topics + 1"; 
               } 

               $sql .= " WHERE forum_id = $forum_id"; 
                
               if( $db->sql_query($sql) ) 
               { 
                  $sql = "UPDATE " . USERS_TABLE . " 
                     SET user_posts = user_posts + 1 
                     WHERE user_id = " . $userdata['user_id']; 
 
替換為

代碼: 選擇全部


               if( $mode == "newtopic" ) 
               { 
                  $sql .= ", forum_topics = forum_topics + 1"; 
                   
                  // Virtual_Money_MOD                               
                  $reward_sql =  ", user_money = user_money + 50"; // 發表主題加 50 
               } 
                
               // Virtual_Money_MOD 
               if( $mode == "reply" ) 
               {                
                  $reward_sql =  ", user_money = user_money + 20";  // 回覆主題加 20                
               } 

               $sql .= " WHERE forum_id = $forum_id"; 
                
               if( $db->sql_query($sql) ) 
               { 
                  // $reward_sql is for money_reward 
                  $sql = "UPDATE " . USERS_TABLE . " 
                     SET user_posts = user_posts + 1 $reward_sql 
                     WHERE user_id = " . $userdata['user_id']; 
 


若找不到上面的那一陀將原本要改posting.php那一部份換成以下這個
modify includes/function_post.php
[find]--------------約474行

代碼: 選擇全部

   if ( $mode != 'poll_delete' ) 
   {       
      $sql = "UPDATE " . USERS_TABLE . " 
         SET user_posts = user_posts $sign 
         WHERE user_id = $user_id"; 

[replace]

代碼: 選擇全部

   if ( $mode != 'poll_delete' ) 
   { 
   //begin Virtual Money Code    
               if( $mode == "newtopic" ) 
               { 
                            
                  $reward_sql =  ", user_money = user_money + 50"; // 發表主題加 50 
               } 
               if( $mode == "reply" ) 
               {                
                  $reward_sql =  ", user_money = user_money + 20";  // 回覆主題加 20                
               } 
       
   // end Virtual Money Code       
      $sql = "UPDATE " . USERS_TABLE . " 
         SET user_posts = user_posts $sign $reward_sql 
         WHERE user_id = $user_id"; 


開啟usercp_viewprofile.php,找到

代碼: 選擇全部



<?php 
'AVATAR_IMG' => $avatar_img, 
?> 


 

在底下加入

代碼: 選擇全部



<?php 
'USER_MONEY' => $profiledata['user_money'], // Virtual_Money_MOD 
'L_USER_MONEY' => $lang['Virtual_Money'], // Virtual_Money_MOD 
?> 


 

存檔ok~

接下來開啟profile_view_body.tpl,找到

代碼: 選擇全部


<tr> 
<td valign="top" align="right" nowrap><span class="gen">{L_TOTAL_POSTS}: </span></td> 
<td valign="top"><b><span class="gen">{POSTS}</span></b><br /><span class="genmed">[{POST_PERCENT_STATS} / {POST_DAY_STATS}]</span> <br /><span class="genmed"><a href="{U_SEARCH_USER}" class="genmed">{L_SEARCH_USER_POSTS}</a></span></td> 
</tr> \r
 
在底下加上虛擬貨幣的表格欄位:

代碼: 選擇全部


<tr><!-- Virtual_Money_MOD --> 
<td valign="middle" align="right" nowrap><span class="gen">{L_USER_MONEY}: </span></td> 
<td><span class="gen"><b>{USER_MONEY}</b></span></td> 
</tr> 
 
圖檔2014新作-達人聯盟

斷斷續續玩了12年的phpbb. 真的看不上別的論壇啊..
回覆文章

回到「2.0」