[分享] [mod]Configure Member Profile Required Fields for plus

phpBB Plus Support
本區是討論關於 phpBB 2 plus 使用上的問題討論!
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
hanson.hung
星球公民
星球公民
文章: 48
註冊時間: 2006-05-07 16:15

[分享] [mod]Configure Member Profile Required Fields for plus

文章 hanson.hung »

########################################################
## 外掛名稱: Configure Member Profile Required Fields Enhance for plus 1.53
## 外掛作者: ycl6 < ycl6@users.sourceforge.net > (Y.C. LIN) http://macphpbbmod.sourceforge.net/
## Enhance修改: Hanson
## 外掛描述: 這個外掛可以讓管理員在控制台中指定會員資料中哪一些欄位必須填入,訪客需要在註冊時填入指定的資料
## 外掛版本: 1.2.1E
##
## 安裝難度: 簡單
## 安裝時間: 10 分鐘
##
## 需要編輯的檔案: 6
## admin/admin_users.php
## includes/constants.php
## language/lang_chinese_traditional_taiwan/lang_admin.php
## includes/usercp_register.php
## templates/fisubsilversh/profile_add_body.tpl
## templates/fisubsilversh/admin/user_edit_body.tpl
##
## 附加的檔案: 2
## phpbb_root_path/admin/admin_profile_field.php
## phpbb_root_path/templates/fisubsilversh/admin/admin_profile_field.tpl
##
## 版權聲明: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
#################################################################
## 由於安全上的考量, 請檢查: http://www.phpbb.com/mods/
## 是否有此外掛的最新版本. 雖然在加入外掛資料庫前,外掛已經經過檢查
## 但是這並不保證外掛中完全沒有安全上的問題.
## 對於不在外掛資料庫 (http://www.phpbb.com/mods/) 內的外掛
## 將不會在 phpbb.com 的討論板內給予支援
##############################################################
## 作者留言:
## 此外掛在 plus 1.53 with 2.0.21 上測試過.
##
##############################################################
## 版本歷史:
##
## 2004-01-22 - 版本 1.0.0
## - 首次發佈
##
## 2004-07-24 - 版本 1.1.0
## - 小蟲修正, 一些程式的更新, 加入 Visual Confirmation 支援
## - 修正外掛安裝說明小修正
##
## 2005-01-23 - 版本 1.1.1
## - 重新為 phpBB 2.0.11 製作 (因為 2.0.11 已有 Visual Confirmation)
## - 修正 usercp_register.php 的錯誤
##
## 2005-11-24 - 版本 1.2.0
## - 重寫了這個外掛的很多地方,並且也移除了不少不需要的程式
##
## 2005-11-26 - 版本 1.2.1
## - 增加了對 admin_users.php 的修改
##
## 2006-09-28 - 版本 1.2.1E (Hanson)
## - 增加了對 旗幟及性別的指定
## - 修正在會員修改個人資料時指定欄位之輸入
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################

#-----[ 複製 ]------------------------------------------
#
Copy phpbb_root_path/*.* to *.*
#
#-----[ SQL ]------------------------------------------
# Run this file once as an administrator and then delete it immediately
CMPRF_db_update.php
#
#-----[ 打開 ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_admin.php
#
#-----[ 尋找 ]------------------------------------------
#
?>
#
#-----[ 之前, 加上 ]------------------------------------------
#
// Configure Member Profile Required Fields
$lang['Profile_config_updated'] = '指定欄位更新完成';
$lang['Click_return_profile_config'] = '點選 %s這裡%s 返回會員資料指定欄位設定';
$lang['Profile_field_config'] = '會員資料指定欄位設定';
$lang['Profile_field_explain'] = '以下表格可以讓你編輯哪一些會員資料在註冊和更新資料時必須填寫.';
$lang['Settings'] = '設定';
$lang['Reg_optional'] = '可不填寫';
$lang['Reg_compulsory'] = '必須填寫';
$lang['CMPRF_mod_version'] = 'Configure Member Profile Required Fields - Version 1.2.1 (2005-11-26)';
#
#-----[ 打開 ]------------------------------------------
#
admin/admin_users.php
#
#-----[ 尋找 ]------------------------------------------
#
{
$mode = '';
}
#
#-----[ 之後, 加上 ]------------------------------------------
#
//-- Start add - Configure Member Profile Required Fields MOD
$sql = "SELECT *
FROM " . PROFILE_CONFIG_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Could not query required field config information", "", __LINE__, __FILE__, $sql);
}

$required_field_config = array();
while ( $row = $db->sql_fetchrow($result) )
{
$required_field_config[$row['config_name']] = $row['config_value'];
}
//-- End add - Configure Member Profile Required Fields MOD
#
#-----[ 尋找 ]------------------------------------------
#
'L_FLAG' => $lang['Country_Flag'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
// Configure Member Profile Required Fields
'L_FLAG' => ($required_field_config['flag']) ? $lang['Country_Flag'] . ' * ' : $lang['Country_Flag'],
#
#
#
#-----[ 尋找 ]------------------------------------------
#
'L_ICQ_NUMBER' => $lang['ICQ'],
'L_MESSENGER' => $lang['MSNM'],
'L_YAHOO' => $lang['YIM'],
'L_WEBSITE' => $lang['Website'],
'L_AIM' => $lang['AIM'],
'L_LOCATION' => $lang['Location'],
'L_OCCUPATION' => $lang['Occupation'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
// Configure Member Profile Required Fields
'L_ICQ_NUMBER' => ($required_field_config['icq']) ? $lang['ICQ'] . ' * ' : $lang['ICQ'],
'L_MESSENGER' => ($required_field_config['msn']) ? $lang['MSNM'] . ' * ' : $lang['MSNM'],
'L_YAHOO' => ($required_field_config['yim']) ? $lang['YIM'] . ' * ' : $lang['YIM'],
'L_WEBSITE' => ($required_field_config['website']) ? $lang['Website'] . ' * ' : $lang['Website'],
'L_AIM' => ($required_field_config['aim']) ? $lang['AIM'] . ' * ' : $lang['AIM'],
'L_LOCATION' => ($required_field_config['location']) ? $lang['Location'] . ' * ' : $lang['Location'],
'L_OCCUPATION' => ($required_field_config['occupation']) ? $lang['Occupation'] . ' * ' : $lang['Occupation'],
#
#-----[ 尋找 ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
// Configure Member Profile Required Fields
'L_INTERESTS' => ($required_field_config['interests']) ? $lang['Interests'] . ' * ' : $lang['Interests'],
#
#-----[ 尋找 ]------------------------------------------
#
'L_GENDER' =>$lang['Gender'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
// Configure Member Profile Required Fields
'L_GENDER' => ($required_field_config['gender']) ? $lang['Gender'] . ' * ' : $lang['Gender'],
#
#-----[ 尋找 ]------------------------------------------
#
'L_SIGNATURE' => $lang['Signature'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
// Configure Member Profile Required Fields
'L_SIGNATURE' => ($required_field_config['signature']) ? $lang['Signature'] . ' * ' : $lang['Signature'],
#
#-----[ 打開 ]------------------------------------------
#
includes/constants.php
#
#-----[ 尋找 ]------------------------------------------
#
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
#
#-----[ 之後, 加上 ]------------------------------------------
#
// Configure Member Profile Required Fields
define('PROFILE_CONFIG_TABLE', $table_prefix.'profile_config');
#
#-----[ 打開 ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ 尋找 ]------------------------------------------
#
$error = FALSE;
#
#-----[ 之後, 加上 ]------------------------------------------
#
//-- Start add - Configure Member Profile Required Fields mod
$fields_empty = FALSE;
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
$error_msg = $lang['Fields_empty'];
#
#-----[ 之後, 加上 ]------------------------------------------
#
$fields_empty = TRUE;
#
#-----[ 尋找 ]------------------------------------------
#
message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
}
#
#-----[ 之後, 加上 ]------------------------------------------
#
//-- Start add - Configure Member Profile Required Fields mod
$sql = "SELECT *
FROM " . PROFILE_CONFIG_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Could not query required field config information", "", __LINE__, __FILE__, $sql);
}

$required_field_config = array();
while ( $row = $db->sql_fetchrow($result) )
{
$required_field_config[$row['config_name']] = $row['config_value'];
}
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
if ( $user_id != $userdata['user_id'] )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
}
#
#-----[ 取代 ]------------------------------------------
#
if ( $user_id != $userdata['user_id'] )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
//-- Start add - Configure Member Profile Required Fields mod
$fields_empty = TRUE;
//-- End add - Configure Member Profile Required Fields mod
}
//-- Start add - Configure Member Profile Required Fields mod
if ( $required_field_config['yim'] && empty($yim))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['icq'] && empty($icq))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['msn'] && empty($msn))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['aim'] && empty($aim))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['occupation'] && empty($occupation))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['interests'] && empty($interests))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['location'] && empty($location))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['website'] && empty($website))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['signature'] && empty($signature))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['flag'] && empty($user_flag))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['gender'] && empty($gender))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
#
#-----[ 之後, 加上 ]------------------------------------------
#
  //-- Start add - Configure Member Profile Required Fields mod
$fields_empty = TRUE;
  //-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
if ($board_config['enable_confirm'] && !$plus_config['enable_antirobot'])
#
#-----[ 之前, 加上 ]------------------------------------------
#
//-- Start add - Configure Member Profile Required Fields mod
if ( $required_field_config['yim'] && empty($yim))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['icq'] && empty($icq))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['msn'] && empty($msn))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['aim'] && empty($aim))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['occupation'] && empty($occupation))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['interests'] && empty($interests))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['location'] && empty($location))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['website'] && empty($website))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
if ( $required_field_config['signature'] && empty($signature))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}

if ( $required_field_config['flag'] && empty($user_flag))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}

if ( $required_field_config['gender'] && empty($gender))
{
$error = TRUE;
if ( $fields_empty == FALSE )
{
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
$fields_empty = TRUE;
}
}
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
'L_FLAG' => $lang['Country_Flag'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
// Start add - Configure Member Profile Required Fields mod
'L_FLAG' => ($required_field_config['flag']) ? $lang['Country_Flag'] . ' * ' : $lang['Country_Flag'],
// End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
'L_ICQ_NUMBER' => $lang['ICQ'],
'L_MESSENGER' => $lang['MSNM'],
'L_YAHOO' => $lang['YIM'],
'L_WEBSITE' => $lang['Website'],
'L_AIM' => $lang['AIM'],
'L_LOCATION' => $lang['Location'],
'L_OCCUPATION' => $lang['Occupation'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
//-- Start add - Configure Member Profile Required Fields mod
'L_ICQ_NUMBER' => ($required_field_config['icq']) ? $lang['ICQ'] . ' * ' : $lang['ICQ'],
'L_MESSENGER' => ($required_field_config['msn']) ? $lang['MSNM'] . ' * ' : $lang['MSNM'],
'L_YAHOO' => ($required_field_config['yim']) ? $lang['YIM'] . ' * ' : $lang['YIM'],
'L_WEBSITE' => ($required_field_config['website']) ? $lang['Website'] . ' * ' : $lang['Website'],
'L_AIM' => ($required_field_config['aim']) ? $lang['AIM'] . ' * ' : $lang['AIM'],
'L_LOCATION' => ($required_field_config['location']) ? $lang['Location'] . ' * ' : $lang['Location'],
'L_OCCUPATION' => ($required_field_config['occupation']) ? $lang['Occupation'] . ' * ' : $lang['Occupation'],
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
//-- Start add - Configure Member Profile Required Fields mod
'L_INTERESTS' => ($required_field_config['interests']) ? $lang['Interests'] . ' * ' : $lang['Interests'],
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
'L_GENDER' =>$lang['Gender'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
//-- Start add - Configure Member Profile Required Fields mod
'L_GENDER' => ($required_field_config['gender']) ? $lang['Gender'] . ' * ' : $lang['Gender'],
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 尋找 ]------------------------------------------
#
'L_SIGNATURE' => $lang['Signature'],
#
#-----[ 之前, 加上 ]------------------------------------------
#
/*
#
#-----[ 之後, 加上 ]------------------------------------------
#
*/
//-- Start add - Configure Member Profile Required Fields mod
'L_SIGNATURE' => ($required_field_config['signature']) ? $lang['Signature'] . ' * ' : $lang['Signature'],
//-- End add - Configure Member Profile Required Fields mod
#
#-----[ 打開 ]------------------------------------------
#
templates/fisubsilversh/profile_add_body.tpl
#
#-----[ 尋找 ]------------------------------------------
#
<tr>
<th colspan="2">{L_PROFILE_INFO}</th>
</tr>
#
#-----[ 之後, 加上 ]------------------------------------------
#
<!-- Start add - Configure Member Profile Required Fields mod -->
<tr>
<td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
</tr>
<!-- End add - Configure Member Profile Required Fields mod -->


#
#-----[ 打開 ]------------------------------------------
#
templates/fisubsilversh/admin/user_edit_body.tpl
#
#-----[ 尋找 ]------------------------------------------
#
<tr>
<th colspan="2">{L_PROFILE_INFO}</th>
</tr>
#
#-----[ 之後, 加上 ]------------------------------------------
#
<!-- Start add - Configure Member Profile Required Fields mod -->
<tr>
<td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
</tr>
<!-- End add - Configure Member Profile Required Fields mod -->
#
#-----[ 儲存/關閉所有檔案 ]------------------------------------------
#
# 外掛修正結束

檔案下載處:請點我下載
construaprende
星球普通子民
星球普通子民
文章: 1
註冊時間: 2006-11-12 14:49
來自: Cuautitlan Izcalli, Mexico
聯繫:

文章 construaprende »

This is not Working For Country Flags

The part of code that says:

代碼: 選擇全部

if ( $required_field_config['flag'] && empty($user_flag))
Means to an empty field

But I was loking at the mysql table, and a user without Flag, has not a null field
Instead, it have
blank.gif
主題已鎖定

回到「phpBB 2 plus 綜合討論」