Seite 1 von 1

User Info erweitern!

Verfasst: 11.03.2003 16:23
von BraveEagle
[ externes Bild ]Was muss ich alles verändern, um ein neues Feld bei den Userdaten einzufügen? ich fände es ganz gut, wenn jemand, der sich ein bissel damit auskennt, einmal ne Beschreibung allgemein macht und die dann veröffentlciht, da ich bei der suchoption nicht wusste was ich eingeben soll und jeder newbie sowas machen will nur mit anderen Fragen davor!
THX

[ externes Bild ]

Verfasst: 11.03.2003 16:29
von Markir
Hallo,

ich hoffe ich konnte Dir damit helfen....

Code: Alles auswählen

################################################################################### 
## 
## Hack Titel:    Neues Feld in Profile einfuegen 
## Hack Version:  1.0.3 
## Autor:         Acid < acid_junky@web.de > 
## Beschreibung:  Ein einfacher Weg um ein neues Feld zum Profil hinzuzufuegen... 
##                z.B. "music". 
## 
## Dateien zu ändern:        9 
##                        admin/admin_users.php 
##                        language/lang_xxx/lang_main.php 
##                        language/lang_xxx/lang_admin.php 
##                        includes/usercp_viewprofile.php 
##                        includes/usercp_register.php 
##                        includes/usercp_avatar.php 
##                        templates/xxx/admin/user_edit_body.tpl 
##                        templates/xxx/profile_add_body.tpl 
##                        templates/xxx/profile_view_body.tpl 
## 
################################################################################### 
## 
## Notiz: 
## Vor jeglichen Aenderungen an Datenbank/Dateien sollten dieser gesichert werden. 
## 
## Dieser Hack fuegt eine weitere Spalte zur 'user' Tabelle hinzu. 
################################################################################### 


SQL QUERY:  (prefix_ angleichen) 

ALTER TABLE phpbb_users ADD user_music VARCHAR(255); 


############################################################################################################################################################################################# 

usercp_viewprofile.php 
---------------------- 

>>FINDE: 
   'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ', 

>>DANACH EINFUEGEN: 
   'MUSIC' => ( $profiledata['user_music'] ) ? $profiledata['user_music'] : ' ', 

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

>>FINDE: 
   'L_INTERESTS' => $lang['Interests'], 

>>DANACH EINFUEGEN: 
   'L_MUSIC' => $lang['Music'], 

############################################################################################################################################################################################# 

usercp_register.php 
------------------- 

>>FINDE: 
   $strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests'); 

>>FINDE IN DIESER ZEILE: 
'interests' 

>>DANACH EINFUEGEN: 
, 'music' => 'music' 

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

>>FINDE: 
   validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature); 

>>FINDE IN DIESER ZEILE: 
$interests 

>>DANACH EINFUEGEN: 
, $music 


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

>>FINDE: 
      $interests = stripslashes($interests); 

>>DANACH EINFUEGEN: 
      $music = stripslashes($music); 

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

>>FINDE: 
         $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 . " 

>>FINDE IN DIESER ZEILE: 
$interests) . "', 

>>DANACH EINFUEGEN 
user_music = '" . str_replace("\'", "''", $music) . "', 

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

>>FINDE: 
         $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) 
            VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $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, "; 

>>FINDE IN DIESER ZEILE: 
user_interests 

>>DANACH EINFUEGEN: 
, user_music 

>>FINDE IN DIESER ZEILE: 
$interests) . "' 

>>DANACH EINFUEGEN: 
, '" . str_replace("\'", "''", $music) . "' 

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

>>FINDE: 
               'INTERESTS' => $interests, 

>>DANACH EINFUEGEN: 
               'MUSIC' => $music, 

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

>>FINDE: 
   $interests = htmlspecialchars(stripslashes($interests)); 

>>DANACH EINFUEGEN: 
   $music = htmlspecialchars(stripslashes($music)); 

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

>>FINDE: 
   $interests = htmlspecialchars($userdata['user_interests']); 

>>DANACH EINFUEGEN: 
   $music = htmlspecialchars($userdata['user_music']); 

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

>>FINDE: 
   display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $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); 

>>FINDE IN DIESER ZEILE: 
$interests 

>>DANACH EINFUEGEN: 
, $music 

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

>>FINDE: 
      'INTERESTS' => $interests, 

>>DANACH EINFUEGEN: 
      'MUSIC' => $music, 

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

>>FINDE: 
      'L_INTERESTS' => $lang['Interests'], 

>>DANACH EINFUEGEN: 
      'L_MUSIC' => $lang['Music'], 


############################################################################################################################################################################################# 

usercp_avatar.php 
----------------- 

>>FINDE: 
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popuppm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat) 

>>FINDE IN DIESER ZEILE: 
&$interests 

>>DANACH EINFUEGEN: 
, &$music 

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

>>FINDE: 
$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popuppm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat'); 

>>FINDE IN DIESER ZEILE: 
'dateformat' 

>>DANACH EINFUEGEN: 
, 'music' 

############################################################################################################################################################################################# 

admin_users.php 
--------------- 

>>FINDE: 
$interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(strip_tags($HTTP_POST_VARS['interests'])) : ""; 

>>DANACH EINFUEGEN: 
$music = ( !empty($HTTP_POST_VARS['music']) ) ? trim(strip_tags( $HTTP_POST_VARS['music'] ) ) : ''; 

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

>>FINDE: 
validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature); 

>>FINDE IN DIESER ZEILE: 
$interests 

>>DANACH EINFUEGEN: 
, $music 

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

>>FINDE: 
$interests = stripslashes($interests); 

>>DANACH EINFUEGEN: 
$music = stripslashes($music); 

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

>>FINDE: 
$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_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 . " 

>>FINDE IN DIESER ZEILE: 
$interests) . "' 

>>DANACH EINFUEGEN: 
, user_music = '" . str_replace("\'", "''", $music) . "' 

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

>>FINDE: 
$interests = stripslashes($interests); 

>>DANACH EINFUEGEN: 
$music = stripslashes($music); 

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

>>FINDE: 
$interests = $this_userdata['user_interests']; 

>>DANACH EINFUEGEN: 
$music = $this_userdata['user_music']; 

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

>>FINDE: 
$s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace("\"", """, $interests) . '" />'; 

>>DANACH EINFUEGEN: 
$s_hidden_fields .= '<input type="hidden" name="music" value="' . str_replace("\"", """, $music) . '" />'; 

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

>>FINDE: 
'INTERESTS' => $interests, 

>>DANACH EINFUEGEN: 
'MUSIC' => $music, 

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

>>FINDE: 
'L_INTERESTS' => $lang['Interests'], 

>>DANACH EINFUEGEN: 
'L_MUSIC' => $lang['Music'], 

############################################################################################################################################################################################# 

lang_admin.php 
------------- 

>>FINDE: 
// 
// That's all Folks! 


>>ADD BEFORE: 
$lang['Music'] = "Music"; 

############################################################################################################################################################################################# 

lang_main.php 
------------- 

>>FINDE: 
// 
// That's all Folks! 

>>ADD BEFORE: 
$lang['Music'] = "Music"; 

############################################################################################################################################################################################# 

profile_add_body.tpl 
-------------------- 

>>FINDE: 
   <tr> 
     <td class="row1"><span class="gen">{L_INTERESTS}:</span></td> 
     <td class="row2"> 
      <input type="text" class="post"style="width: 200px"  name="interests" size="35" maxlength="150" value="{INTERESTS}" /> 
     </td> 
   </tr> 

>>DANACH EINFUEGEN: 
   <tr> 
     <td class="row1"><span class="gen">{L_MUSIC}:</span></td> 
     <td class="row2"> 
      <input type="text" class="post"style="width: 200px"  name="music" size="35" maxlength="150" value="{MUSIC}" /> 
     </td> 
   </tr> 

############################################################################################################################################################################################# 

profile_view_body.tpl 
--------------------- 

>>FINDE: 
      <tr> 
        <td valign="top" align="right"><span class="gen">{L_INTERESTS}:</span></td> 
        <td> <b><span class="gen">{INTERESTS}</span></b></td> 
      </tr> 

>>DANACH EINFUEGEN: 
      <tr> 
        <td valign="top" align="right"><span class="gen">{L_MUSIC}:</span></td> 
        <td> <b><span class="gen">{MUSIC}</span></b></td> 
      </tr> 

############################################################################################################################################################################################# 

user_edit_body.tpl 
------------------ 

>>FINDE: 
   <tr> 
     <td class="row1"><span class="gen">{L_INTERESTS}</span></td> 
     <td class="row2"> 
      <input type="text" name="interests" size="35" maxlength="150" value="{INTERESTS}" /> 
     </td> 
   </tr> 

>>DANACH EINFUEGEN: 
        <tr> 
          <td class="row1"><span class="gen">{L_MUSIC}</span></td> 
          <td class="row2"> 
                <input type="text" name="music" size="35" maxlength="50" value="{MUSIC}" /> 
        </td> 
         </tr> 


############################################################################################################################################# 


hier sind jetzt meine änderungen die gemacht werden müssen damit das auch in der Viewtopic angezeigt wird. 

öffne Viewtopic.php 
----------------------- 
suche nach 
Code: 
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, 


füge danach direkt in der Zeile ein 
Code: 
u.user_music, 


suche nach 
Code: 
$poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : ''; 


füge danach ein 
Code: 
$poster_music = ( $postrow[$i]['user_music'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Music'] . ': ' . $postrow[$i]['user_music'] : ''; 


suche nach 
Code: 
'POSTER_FROM' => $poster_from, 


füge danach ein 
Code: 
'POSTER_MUSIC' => $poster_music, 


speichere und schließe Viewtopic.php 


öffne templates/subSilver/viewtopic_body.tpl 
---------------------------------------------------- 
suche nach 
Code: 
{postrow.POSTER_FROM} 


füge direkt in der Zeile danach ein 
Code: 
<br />{postrow.POSTER_MUSIC} 


speicher und schließe viewtopic_body.tpl 
jetzt nur noch alles hochladen und dann steht der Eintrag auch in der Viewtopic under Wohnort in dem Fall. 
music muss natürlich noch angepasst werden oben im Orginal Mod auch. 

Jetzt aber viel spaß mit der kleinen Anleidung

Verfasst: 11.03.2003 17:59
von BraveEagle
[ externes Bild ] vielen dank