Pagina 1 van 1

Haar- en oogkleur mod

Geplaatst: 27 mar 2006, 13:33
door Baldo
Ik ben druk in de weer met de volgende mod,

###############################################
## Hack Title: Add new field to profile
## Hack Version: 1.2.2 (ex phpbb 2.0.4)
## Author Acid
##
## Description: Just a simple way to add a new field to profile. "info" can be changed to "whatever" of course but be aware of the spelling (e.g. "INFO", "info", "user_info"). If you want to add more than one field duplicate the following steps and change "info" to "whatever" (be aware of the spelling). The field "info" is just an example.
##########################################

Deze mod wil ik o.a. gebruiken voor het invoeren van de haar- en oogkleur in de profiel. Het is voor een dating-pagina bedoeld.

Mijn php-kennis is nog onvoldoende om het in orde te krijgen.
En deze mod is te "simpel" voor het geen wat ik wil.
Het is de bedoeling dat je in je profiel, d.m.v. een dropdown menu, een keuze kan maken tussen verschillende haarkleuren.

#
#-----[ SQL ]-------------------------------------------
#
Is de keuze VARCHAR(255) de juiste?
Komt op deze manier de keuze van de dropdownmenu op de juiste plek?
ALTER TABLE phpbb_users ADD user_hair VARCHAR(255) AFTER user_interests;
#
# language/lang_english/lang_main.php
#
$lang['Hair'] = 'What color is your hair?';
$lang['Hair_Blonde'] = 'Blonde';
$lang['Hair_Brown'] = 'Brown';
$lang['Hair_LBrown'] = 'Light Brown';
$lang['Hair_DBrown'] = 'Darker Brown';
$lang['Hair_Black'] = 'Black';
$lang['Hair_Gray'] = 'Gray';
$lang['Hair_LGray'] = 'Light Gray';
$lang['Hair_Red'] = 'Red';
$lang['Hair_White'] = 'White';
$lang['Hair_Bald'] = 'Bald';
#
# includes/usercp_viewprofile.php
#
'HAIR' => ( $profiledata['user_hair'] ) ? $profiledata['user_hair'] : ' ',
'L_HAIR' => $lang['Hair'],

#
# includes/usercp_register.php
#
achter ($strip_var_list = array() 'interests'

, 'hair' => 'hair'

achter (2x) $interests = stripslashes($interests);

$hair = stripslashes($hair);

achter $interests) . "'

, user_hair = '" . str_replace("\'", "''", $hair) . "'

achter ($sql = "INSERT INTO " . USERS_TABLE . ") user_interests

, user_hair

achter ($sql = "INSERT INTO " . USERS_TABLE . ") $interests) . "'

, '" . str_replace("\'", "''", $hair) . "'

achter $interests = $userdata['user_interests'];

$hair = $userdata['user_hair'];

achter (display_avatar_gallery($mode, $avatar_category) , $interests

, $hair

achter ($template->assign_vars(array() 'INTERESTS' => $interests,

'HAIR' => $hair,
'L_HAIR' => $lang['Hair'],

#
# includes/usercp_avatar.php
#
achter (function display_avatar_gallery($mode, &$category) &$interests

, &$hair

achter ($params = array('coppa', 'user_id') 'interests'

, 'hair'
#
# admin/admin_users.php
#
achter $interests = ( !empty($HTTP_POST_VARS['interests']) ) ? trim(strip_tags( $HTTP_POST_VARS['interests'] ) ) : '';

$hair = ( !empty($HTTP_POST_VARS['hair']) ) ? trim(strip_tags( $HTTP_POST_VARS['hair'] ) ) : '';

achter (2x) $interests = htmlspecialchars(stripslashes($interests));

$hair = htmlspecialchars(stripslashes($hair));

achter ($sql = "UPDATE " . USERS_TABLE . ") $interests) . "'

, user_hair = '" . str_replace("\'", "''", $hair) . "'

achter $interests = htmlspecialchars($this_userdata['user_interests']);

$hair = htmlspecialchars($this_userdata['user_hair']);

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

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

achter 'INTERESTS' => $interests,

'HAIR' => $hair,
'L_HAIR' => $lang['Hair'],
hoe verwijs ik naar function Hair_Profile_Dropdowns (zie onderaan)? Zo iets - 'HAIR' => 'Hair_Profile_Dropdowns',

#
# templates/xxx/profile_add_body.tpl
#
<tr>
<td class="row1"><span class="gen">{L_HAIR}:</span></td>
<td class="row2"> <input type="text" class="post"style="width: 200px" name="info" size="35" maxlength="150" value="{HAIR}" /> </td>
</tr>

#
# templates/xxx/profile_view_body.tpl
#
<tr>
<td valign="top" align="right"><span class="gen">{L_HAIR}:</span></td>
<td> <b><span class="gen">{HAIR}</span></b></td>
</tr>
#
# templates/xxx/admin/user_edit_body.tpl
#
<tr>
<td class="row1"><span class="gen">{L_HAIR}</span></td>
<td class="row2"> <input class="post" type="text" name="hair" size="35" maxlength="50" value="{HAIR}" /> /td>
</tr>

#
# ???????? waar kan ik onderstaande het beste plaatsen?
#

Klopt onderstaande?
function Hair_Profile_Dropdowns
{

$select_color .= '<select name="Hair">'; //-language/lang_english/lang_main.php
$select_color .= '<option selected value="" class="post">'. $lang['Hair'] .'</option>';
$select_color .= '<option value="01" class="post" ') .'>'. $lang['Hair_Blonde'] .'</option>';
$select_color .= '<option value="02" class="post" ') .'>'. $lang['Hair_Brown'] .'</option>';
$select_color .= '<option value="03" class="post" ') .'>'. $lang['Hair_LBrown'] .'</option>';
$select_color .= '<option value="04" class="post" ') .'>'. $lang['Hair_DBrown'] .'</option>';
$select_color .= '<option value="05" class="post" ') .'>'. $lang['Hair_Black'] .'</option>';
$select_color .= '<option value="06" class="post" ') .'>'. $lang['Hair_Gray'] .'</option>';
$select_color .= '<option value="07" class="post" ') .'>'. $lang['Hair_LGray'] .'</option>';
$select_color .= '<option value="08" class="post" ') .'>'. $lang['Hair_Red'] .'</option>';
$select_color .= '<option value="09" class="post" ') .'>'. $lang['Hair_White'] .'</option>';
$select_color .= '<option value="10" class="post" ') .'>'. $lang['Hair_Bald'] .'</option>';
$select_color .= '</select>';
}
Alvast bedankt voor de moeite voor het bekijken en antwoorden van mijn vragen.

Geplaatst: 27 mar 2006, 17:15
door Bee

Code: Selecteer alles

function Hair_Profile_Dropdowns 
{ 

$select_color .= '<select name="Hair">'; //-language/lang_english/lang_main.php 
$select_color .= '<option selected value="" class="post">'. $lang['Hair'] .'</option>'; 
$select_color .= '<option value="01" class="post" ') .'>'. $lang['Hair_Blonde'] .'</option>'; 
$select_color .= '<option value="02" class="post" ') .'>'. $lang['Hair_Brown'] .'</option>'; 
$select_color .= '<option value="03" class="post" ') .'>'. $lang['Hair_LBrown'] .'</option>'; 
$select_color .= '<option value="04" class="post" ') .'>'. $lang['Hair_DBrown'] .'</option>'; 
$select_color .= '<option value="05" class="post" ') .'>'. $lang['Hair_Black'] .'</option>'; 
$select_color .= '<option value="06" class="post" ') .'>'. $lang['Hair_Gray'] .'</option>'; 
$select_color .= '<option value="07" class="post" ') .'>'. $lang['Hair_LGray'] .'</option>'; 
$select_color .= '<option value="08" class="post" ') .'>'. $lang['Hair_Red'] .'</option>'; 
$select_color .= '<option value="09" class="post" ') .'>'. $lang['Hair_White'] .'</option>'; 
$select_color .= '<option value="10" class="post" ') .'>'. $lang['Hair_Bald'] .'</option>'; 
$select_color .= '</select>'; 
}
Er moet () staan na de functienaam, OOK als je hem aanroeps. Je kan dat het beste plaatsen in includes/functions.php

De volgorde in de database heeft geen invloed op de volgorde in het profiel, dat werkt gewoon met HTML.

Geplaatst: 27 mar 2006, 20:07
door Baldo
Het wordt dus function Hair_Profile_Dropdowns ($haircolor)

En het aanroepen doe ik dan zo?
#
# admin/admin_users.php
#

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

$hair = ( !empty($HTTP_POST_VARS['hair']) ) ? trim(strip_tags( $HTTP_POST_VARS['hair'] ) ) : '';

achter (2x) $interests = htmlspecialchars(stripslashes($interests));

$hair = htmlspecialchars(stripslashes($hair));

achter ($sql = "UPDATE " . USERS_TABLE . ") $interests) . "'

, user_hair = '" . str_replace("\'", "''", $hair) . "'

achter $interests = htmlspecialchars($this_userdata['user_interests']);

$hair = htmlspecialchars($this_userdata['user_hair']);

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

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

achter 'INTERESTS' => $interests,

'HAIR' => $haircolor,
'L_HAIR' => $lang['Hair'],
Dat is alles?