anlatılan makale 2.04 versiyon için yazılmıştır..
dosya içeriğinde değişmeler olmuş olabilir..
bu yazıyı alıntı kuralları içinde istediğiniz gibi kendi sitelerinizde yayınlayabilirsiniz..
phpBBmod.com
merhaba;
bu yazıda phpbb sql tablosuna yeni bir satır eklemeyi ve bu yeni satırla forumda, phpbb veri girişi eklemeyi, görüntülemeyi, değiştirmeyi göreceğiz..
ilk adımda phpmyadminden database imize bağlanıp gerekli tabloyu yerleştirelim..
Evet ilk olarak kullanıcılarımızın bulunduğu tabloya(phpbb_users) yeni bir kolon ekleyeceğiz.
yaratacağımız tablo ismi kullanıcının gerçek adıyla ilgili olacak.
Gerçek İsim adlı satırı phpbb_user ın içine yaratıyoruz ...
Kod: Tümünü seç
#
#-----[ SQL ]------------------------------------------
#
# yapıyı bozmamak için [b]user_ [/b] kalıbıyla prefix açıyorum istenirse farklıda açılabilir...
# yaratılacak tablo satırımızın ismi user_realname
#
ALTER TABLE phpbb_users ADD user_realname VARCHAR (50)
bu örnekte Gerçek İsim bilgisini kullanıcı adının hemen altına yerleştireceğiz..
ilerleyen bölümlerde farklı yerlerede nasıl ekleneceği açıklanacaktır..
Kod: Tümünü seç
#
#----- [ OPEN ] -------------------------------------
# Burada, kullanıcının gerçek ismini girmek için kayıt ve profil bölümleri modifiye ediliyor..
includes/usercp_register.php
#
#----- [ FIND ] -------------------------------------
#
$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests');
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
'username' => 'username',
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
'realname' => 'realname',
#
#----- [ FIND ] -------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
" . $avatar_sql . "
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
, user_realname = '" . str_replace("\'", "''", $realname) . "'
#
#----- [ FIND ] -------------------------------------
#
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
user_allow_pm,
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
user_realname,
#
#----- [ FIND ] -------------------------------------
#
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
$user_style, 0, 1,
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
'$realname',
#
#----- [ FIND ] -------------------------------------
#
# ÖNEMLİ BU KISIMDA ARANAN SATIRDAN 2 TANE VAR İKİSİNİDE BULUP EKLEMEYİ YAPIN!
$username = stripslashes($username);
#
#----- [ AFTER, ADD ] -------------------------------------
#
$realname = stripslashes($realname);
#
#----- [ FIND ] -------------------------------------
#
else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($H
TTP_POST_VARS['cancelavatar']) )
{
$user_id = $userdata['user_id'];
$username = $userdata['username'];
#
#----- [ AFTER, ADD ] -------------------------------------
#
$realname = $userdata['user_realname'];
#
#----- [ FIND ] -------------------------------------
#
display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, &$new_password, &$cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
$userdata['session_id']
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
, $realname
#
#----- [ FIND ] -------------------------------------
#
$template->assign_vars(array(
'USERNAME' => $username,
#
#----- [ AFTER, ADD ] -------------------------------------
#
'REALNAME' => $realname,
#
#----- [ FIND ] ----------------------------
#
'L_EMAIL_ADDRESS' => $lang['Email_address'],
#
#----- [ AFTER, ADD ] -------------------------------------
#
'L_REALNAME' => $lang['real_name'],
'L_REALNAME_VIEWABLE' => $lang['real_name_viewable'],
#
#----- [ OPEN ] -------------------------------------
#
includes/usercp_avatar.php
#
#----- [ FIND ] -------------------------------------
#
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popuppm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
&$session_id
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
, &$realname
#
#----- [ FIND ] -------------------------------------
#
$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popuppm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');
#
#----- [ IN-LINE, FIND ] -------------------------------------
#
'dateformat'
#
#----- [ IN-LINE AFTER, ADD ] -------------------------------------
#
, 'realname'
#
#-----[ OPEN ]------------------------------------------
# Bu bölüm kayıt esnasında oluşturacağımız gerçek isim değerini girmemizi sağlayacak
# ve tabiki profilede eklenecek.
# Bu kısımdaki modifikasyonlar
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
<td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="40" value="{USERNAME}" /></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_REALNAME}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="realname" size="25" maxlength="50" value="{REALNAME}" />
</td>
</tr>
Kod: Tümünü seç
</tr>
Evet şimdi kullanıcılarımızın bu yeni tabloyu görmelerini sağlayalım..
kullanıcının profilinde görmelerine izin veriyoruz, yine basit html bilgisini kullanarak siz kendi istediğiniz yerede koyabilirsiniz. Biz kullanıcı adının hemen altına yerleştirelim..
Kod: Tümünü seç
#
#-----[ OPEN ]------------------------------------------
#
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'REALNAME' => ( $realname ) ? $realname : '&',
#
#-----[ FIND ]------------------------------------------
#
//
// Generate page
//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$realname = $profiledata['user_realname'];
#
#-----[ FIND ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_REALNAME' => $lang['real_name'],
#
#-----[ OPEN ]------------------------------------------
#
# ÖNEMLİ AKTİF OLARAK KULLANDIĞINIZ TÜM TEMALARA UYGULAMALISINIZ..
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_JOINED}:&</span></td>
#
#-----[ BEFORE ADD ]----------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_REALNAME}:&</span></td>
<td><b><span class="gen">{REALNAME}</span></b></td>
</tr>

İsmi Gerçek İsim olsun. Gerçek İsim değerini siz istediğiniz bir şekilde başlık olarak koyabilirsiniz.
Kod: Tümünü seç
#
#-----[ OPEN ]------------------------------------------
#
# Kullandığınız tüm dillere göre bu işlemi tekrarlamalısınız. İsteseniz İngilizce dil dosyası için yapmayabilirniz
#
Türkçe dil dosyası için
AÇ
[tr]
language/lang_turkish/lang_main.php
İngilizce dil doyası için
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
Türkçe dil dosyasında aranacak kısım(phpbbturkey.com dil dosyasına göre):
//
// Errors (not related to a
// specific failure on a page)
//
$lang['Information'] = 'Bilgi';
$lang['Critical_Information'] = 'Kritik Bilgi';
İngilizce dil dosyasında aranacak kısım:
//
// Errors (not related to a
// specific failure on a page)
//
$lang['Information'] = 'Information';
$lang['Critical_Information'] = 'Critical Information';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
Türkçe eklenecek kısım:
//
// Language variables for the New field Mod
//
$lang['real_name'] = 'Gerçek İsim';
İngilizce eklenecek kısım:
//
// Language variables for the New field Mod
//
$lang['real_name'] = 'Real Name';
Son olarak admin yetkisiyle bu yeni değeri editlemek istediğimizde yönetim paneline bu bölümü nasıl ekleyeceğimizi göreceğiz.
biz yine kullanıcı isminin hemen altına ekleyeceğiz Siz isteğiniz bir yerede koyabilirsiniz..
Kod: Tümünü seç
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags( $HTTP_POST_VARS['username'] ) ) : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$realname = ( !empty($HTTP_POST_VARS['realname']) ) ? trim(strip_tags( $HTTP_POST_VARS['realname'] ) ) : '';
#
#-----[ FIND ]------------------------------------------
#
$username = stripslashes($username);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$realname = stripslashes($realname);
#
#-----[ FIND ]------------------------------------------
#
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
#
#-----[ IN-LINE, FIND ]------------------------------------------
#
. $avatar_sql . "
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_realname = '" . str_replace("\'", "''", $realname) . "'
#
#-----[ FIND ]------------------------------------------
#
$username = htmlspecialchars(stripslashes($username));
#
#-----[ AFTER, ADD ]------------------------------------------
#
$realname = htmlspecialchars(stripslashes($realname));
#
#-----[ FIND ]------------------------------------------
#
$username = htmlspecialchars($this_userdata['username']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$realname = htmlspecialchars($this_userdata['user_realname']);
#
#-----[ FIND ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="username" value="' . str_replace("\"", "&", $username) . '" />';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="realname" value="' . str_replace("\"", "&", $realname) . '" />';
#
#-----[ FIND ]------------------------------------------
#
'USERNAME' => $username,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'REALNAME' => $realname,
#
#-----[ FIND ]------------------------------------------
#
'L_USERNAME' => $lang['Username'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_REALNAME' => $lang['real_name'],
Kod: Tümünü seç
#
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
<td class="row2">
<input class="post" type="text" name="username" size="35" maxlength="40" value="{USERNAME}" />
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1" width="38%"><span class="gen">{L_REALNAME}: *</span></td>
<td class="row2">
<input class="post" type="text" name="realname" size="35" maxlength="40" value="{REALNAME}" />
</td>
</tr>
cupra tarafından çevirilmiştir..
diğer sitelerde kullanılacaksa alıntı kurallarına uygun bir şekilde adresimiz belirtilmelidir..
2.04 kodlarına göre yapılmıştır.. bazı değişiklikler olabileceğini belirtelim. kodların tamamını bulamayabilirsiniz.
phpBB mantığını anlamanıza yardımcı olacaktır..
cupra
phpbbmod.com
01/08/2006 01:25