Hi
this is my first MOD and I hope you will like this. I dont know whetter its perfect but on my page it gone. You can help me and make this code better or so.
Description / BeschreibungEng:In this MOD you can allow your users to display the ZIP Code on the member_profile on the GERMAN map.
Ger:In diesem MOD ist es möglich die PLZ (die der User bei der Registrierung eingibt) auf der deutschen Karte anzuzeigen.
Change files:
member.php
includes/db_field_definitions.php
includes/page_header.php
lang/deutsch/main.php
templates/default/register_form.html
templates/default/member_profile
New Folder:
templates/default/images/plz
1.)
open includes/db_field_definitions.php
add in the end just before ?> this code
$additional_user_fields['plz'] = array($lang['plz'], "text", 1);
2.)
open member.php
and after
if (!empty($user_row['user_email']) && (!isset($user_row['user_showemail']) || (isset($user_row['user_showemail']) && $user_row['user_showemail'] == 1))) {
$user_email = $user_row['user_email'];
$user_email_save = str_replace("@", " at ", $user_row['user_email']);
if (!empty($url_mailform)) {
$user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $user_row['user_id'], $url_mailform));
}
else {
$user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&".URL_USER_ID."=".$user_row['user_id']);
}
$user_email_button = "<a href=\"".$user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$user_email_save."\" /></a>";
}
else {
$user_email = REPLACE_EMPTY;
$user_email_save = REPLACE_EMPTY;
$user_mailform_link = REPLACE_EMPTY;
$user_email_button = REPLACE_EMPTY;
}
add this
// PLZ 2 Stellen
$max_string_laenge = 3;
if(strlen($user_row['plz'])>$max_string_laenge) $postleitzahl = substr($user_row['plz'],0,($max_string_laenge-1))."...";
else $postleitzahl = $user_row['plz'];
// PLZ 1 Stelle
$max_string_laenge = 2;
if(strlen($user_row['plz'])>$max_string_laenge) $postleitzahl_1 = substr($user_row['plz'],0,($max_string_laenge-1));
else $postleitzahl_1 = $user_row['plz'];
// PLZ Ende
find
$site_template->register_vars(array(
"user_id" => $user_row['user_id'],
"user_name" => (isset($user_row['user_name'])) ? format_text($user_row['user_name'], 2) : REPLACE_EMPTY,
and insert below
"postleitzahl" => $postleitzahl,
"postleitzahl_1" => $postleitzahl_1,
3.)
open templates/default/register_form.html
after
<tr>
<td class="row1"><b>{lang_email}</b></td>
<td class="row1">
<input type="text" name="user_email" size="30" class="input" value="{user_email}" />
</td>
</tr>
add this
<tr>
<td class="row1"><b>{lang_plz}</b></td>
<td class="row1">
<input type="text" maxlength="5" name="plz" class="input_register_plz" value="{plz}">
</td>
</tr>
4.)
open includes/page_header.php
find
$site_template->register_vars(array(
"lang_site_stats" => $lang['site_stats'],
and insert below
"lang_plz" => $lang[plz],
5.)
open lang/deutsch/main.php
add at the end just before ?> this
$lang['plz'] = "PLZ";
6.)
open templates/member_profile.html
add after
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
this
<tr>
<td class="row1"><b>{lang_plz}</b></td>
<td class="row1">{postleitzahl}</td>
</tr>
<tr>
<td class="row1"> </td>
<td class="row1"><img src="{template_url}/images/plz/{postleitzahl_1}.png"></td>
</tr>
7.)
Download the files , extract it in templates/default/images/plz
8.)
Upload all files you change and upload the new files,too.
9.)
go to your
phpmyAdmin to the _user table and add 1 new field:
Name: plz
Typ: Varchar
Länge: 5
Standart: D
10.) Now finish. Register a new user and test it out.
I dont know whetter i have all here but i think so. I have test it on 4images 1.7.3 width a lot of MOD's like photo, bday, guestbook, pm, gender ....
Please help to make this better or something other.
Greetz