###############################################
## Mod Title: Gender part 1
## Mod Version: 1.1.2
## Author: Niels Chr Rød. Denmark < ncr@db9.dk > (modified by novalis)
## Description: This mod will add a Gender field into your users' profile.
## This mod is for phpBB2 ver 2.0.0
##
## Altered by novalis at novalis dot org to include various alternate
## gender options. I didn't have time to learn PHP, so the code is just
## as terrible as it was when I found it.
##
## Installation Level: Easy
## Installation Time: 15-25 Minutes
## Files To Edit:
## phpBB2/includes/usrcp_register.php
## phpBB2/includes/usrcp_viewprofile.php
## phpBB2/includes/usrcp_avatar.php
## files to edit for each language:
## /language/lang_xx/lang_main.php
## files to edit for each template:
## /templates/SubSliver/profile_view_body.tpl
## /templates/SubSliver/profile_add_body.tpl
##
###############################################
##
## Installation Notes:
##
## If you are using prefixes for you DB table names, then you have to modify
## the SQL commands
## e.g. if you are using phpBB_ as prefix, then use this SQL instead
## ALTER TABLE phpbb_users ADD user_lastlogon INT (11) DEFAULT '0'
##
## Please also keep in mind, if you are using more than one language file or theme at your
## site, you will need to edit the correct files for each occurrence. Good Luck!
###############################################
#
#-----[ ACTION ]------------------------------------------
#
# You will need to add one new field into your users table in your SQL database.
SQL-query:
ALTER TABLE users ADD user_gender TINYINT
#
#-----[ ACTION ]------------------------------------------
#
# OPEN FILE: phpBB2/language/lang_XX/lang_main.php (make sure to edit this file for every language your board uses).
# AT THE BOTTOM OF THE PAGE
[ADD]:
//Add on for Gender Mod
$lang['Gender'] = "Gender";//used in users profile to display witch gender he/she is
$lang['Male'] = "Male";
$lang['Female']="Female";
$lang['MTF']="Male_To_Female_Transgendered";
$lang['FTM']="Female_To_Male_Transgendered";
$lang['Neuter']="Neuter";
$lang['Herm']="Hermaphrodite";
$lang['No_gender_specify'] = "None Specified";
#
#-----[ ACTION ]------------------------------------------
#
## OPEN FILE: phpBB2/includes/usercp_register.php
[FIND]:
$signature = str_replace('
', "\n", $signature);
[ADD AFTER]:
$gender = ( isset($HTTP_POST_VARS['gender']) ) ? $HTTP_POST_VARS['gender'] : 0;
#
#-----[ ACTION ]------------------------------------------
#
[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 . "
[REPLACE WITH]:
$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 . ", user_gender=$gender
#
#-----[ ACTION ]------------------------------------------
#
[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)
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, ";
[REPLACE WITH]:
$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_gender, 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, '$gender',";
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
$interests = htmlspecialchars($userdata['user_interests']);
[ADD AFTER]:
$gender=$userdata['user_gender'];
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
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);
[REPLACE WITH]:
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,$gender);
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
$smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
[ADD EFTER]:
switch ($gender)
{
case 1: $gender_male_checked="checked=\"checked\"";break;
case 2: $gender_female_checked="checked=\"checked\"";break;
case 3: $gender_mtf_checked="checked=\"checked\"";break;
case 4: $gender_ftm_checked="checked=\"checked\"";break;
case 5: $gender_neuter_checked="checked=\"checked\"";break;
case 6: $gender_herm_checked="checked=\"checked\"";break;
default:$gender_no_specify_checked="checked=\"checked\"";
}
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
$template->assign_vars(array(
'USERNAME' => $username,
'EMAIL' => $email,
'YIM' => $yim,
'ICQ' => $icq,
'MSN' => $msn,
'AIM' => $aim,
'OCCUPATION' => $occupation,
'INTERESTS' => $interests,
[ADD AFTER]:
'LOCK_GENDER' =>($mode!='register') ? "DISABLED":"",
'GENDER' => $gender,
'GENDER_NO_SPECIFY_CHECKED' => $gender_no_specify_checked,
'GENDER_MALE_CHECKED' => $gender_male_checked,
'GENDER_FEMALE_CHECKED' => $gender_female_checked,
'GENDER_MTF_CHECKED' => $gender_mtf_checked,
'GENDER_FTM_CHECKED' => $gender_ftm_checked,
'GENDER_NEUTER_CHECKED' => $gender_neuter_checked,
'GENDER_HERM_CHECKED' => $gender_herm_checked,
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
'L_INTERESTS' => $lang['Interests'],
[ADD AFTER]:
'L_GENDER' =>$lang['Gender'],
'L_GENDER_MALE' =>$lang['Male'],
'L_GENDER_FEMALE' =>$lang['Female'],
'L_GENDER_MTF' =>$lang['Male_To_Female_Transgendered'],
'L_GENDER_FTM' =>$lang['Female_To_Male_Transgendered'],
'L_GENDER_NEUTER' =>$lang['Neuter'],
'L_GENDER_HERM' =>$lang['Hermaphrodite'],
'L_GENDER_NOT_SPECIFY' =>$lang['No_gender_specify'],
################################### This completes the changes in usercp_register.php ##############################
#
#-----[ ACTION ]------------------------------------------
#
## OPEN FILE: phpBB2/includes/usercp_viewprofile.php
[FIND]:
//
// Generate page
[ADD BEFORE]:
if ( !empty($profiledata['user_gender']))
{
switch ($profiledata['user_gender'])
{
case 1: $gender=$lang['Male'];break;
case 2: $gender=$lang['Female'];break;
case 3: $gender=$lang['Male_To_Female_Transgendered'];break;
case 4: $gender=$lang['Female_To_Male_Transgendered'];break;
case 4: $gender=$lang['Neuter'];break;
case 5: $gender=$lang['Hermaphrodite'];break;
default:$gender=$lang['No_gender_specify'];
}
} else $gender=$lang['No_gender_specify'];
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ',
[ADD AFTER]:
'GENDER' => $gender,
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
'L_INTERESTS' => $lang['Interests'],
[ADD AFTER]:
'L_GENDER' => $lang['Gender'],
################################### This completes the changes in usercp_viewprofile.php ##############################
#
#-----[ ACTION ]------------------------------------------
#
## OPEN FILE: phpBB2/includes/usercp_avatar.php
[FIND]:
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)
[REPLACE WITH]:
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, &$gender)
#
#-----[ ACTION ]------------------------------------------
#
[FIND]:
$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');
[REPLACE WITH]:
$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', 'gender');
################################### This completes the changes in usercp_avatar.php ##############################
#
#-----[ ACTION ]------------------------------------------
#
#OPEN FILE: phpBB2/templates/template_dirXX/profile_view_body.tpl (make sure to edit this file for every theme you use).
[FIND]: