############################################### ## 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]: {L_INTERESTS}: {INTERESTS} [ADD AFTER]: {L_GENDER}: {GENDER} ################################### This completes the changes in profile_view_body.tpl ############################## # #-----[ ACTION ]------------------------------------------ # #OPEN FILE: phpBB2/templates/template_dirXX/profiel_add_body.tpl (make sure to edit this file for every theme you use). [FIND]: {L_INTERESTS}: [ADD AFTER]: {L_GENDER}: {L_GENDER_NOT_SPECIFY}   {L_GENDER_MALE}   {L_GENDER_FEMALE} {L_GENDER_MTF} {L_GENDER_FTM} {L_GENDER_NEUTER} {L_GENDER_HERM} This completes the profile portion of the mod. Users will now be able to change their gender selection, and other users will be able to view their selections. Users who do not specify a gender, the script will default to "None Specified." ############################################### ## Mod Title: Gender part 2 ## Mod Version: 1.1.1 ## Author: Niels Chr Rød. Denmark < ncr@db9.dk > ## Made into text format by: L. Chance ## Description: This mod will add display "Gender: " in each of their posts. ## This mod is for phpBB2 ver 2.0.0 ## ## ## Installation Level: Easy ## Installation Time: 5-10 Minutes ## Files To Edit: viewtopic.php ## files to edit for each template: ## /templates/SubSliver/subsilver.cfg ## /templates/SubSliver/viewtopic_body.tpl ## Included Files: ## /templates/SubSliver/icon_minigender_male.gif ## /templates/SubSliver/icon_minigender_female.gif ## /templates/SubSliver/icon_minigender_mtf.gif ## /templates/SubSliver/icon_minigender_ftm.gif ## /templates/SubSliver/icon_minigender_neuter.gif ## /templates/SubSliver/icon_minigender_herm.gif ############################################### # #-----[ ACTION ]------------------------------------------ # #OPEN FILE: phpBB2/viewtopic.php [FIND]: // // Go ahead and pull all data for this topic // $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid [REPLACE WITH]: // // Go ahead and pull all data for this topic // $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, u.user_gender, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid # #-----[ ACTION ]------------------------------------------ # [FIND]: // // Generate ranks, set them to empty string initially. // $poster_rank = ''; $rank_image = ''; [ADD AFTER]: $gender_image = ''; # #-----[ ACTION ]------------------------------------------ # [FIND]: $pm_img = '' . $lang['Send_private_message'] . ''; [ADD AFTER]: if ( !empty($postrow[$i]['user_gender'])) { switch ($postrow[$i]['user_gender']) { case 1 : $gender_image = $lang['Gender'].":\"""; break; case 2 : $gender_image = $lang['Gender'].":\"""; break; case 3 : $gender_image = $lang['Gender'].":\"""; break; case 4 : $gender_image = $lang['Gender'].":\"""; break; case 5 : $gender_image = $lang['Gender'].":\"""; break; case 6 : $gender_image = $lang['Gender'].":\"""; break; default : $gender_image=""; } } # #-----[ ACTION ]------------------------------------------ # [FIND]: 'POSTER_RANK' => $poster_rank, [ADD AFTER]: 'POSTER_GENDER' => $gender_image, # #-----[ ACTION ]------------------------------------------ # [FIND]: 'DELETE' => $delpost, [ADD AFTER]: 'L_GENDER' => $lang['Gender'], ################################### This completes the changes in viewtopic.php ############################## # #-----[ ACTION ]------------------------------------------ # # ! optional, not all themes NEED this part of the mod, but it is # recomended to do it to them all. # Only those themes who have this part will have the mod visble # therefor the least you need is to do this to the SubSilver theme. # #OPEN FILE: phpBB2/templates/template_dirXX/template_name.cfg [FIND]: $images['icon_newest_reply'] = "$current_template_images/icon_newest_reply.gif"; [ADD AFTER]: $images['icon_minigender_male'] = "$current_template_images/icon_minigender_male.gif"; $images['icon_minigender_female'] = "$current_template_images/icon_minigender_female.gif"; $images['icon_minigender_mtf'] = "$current_template_images/icon_minigender_mtf.gif"; $images['icon_minigender_ftm'] = "$current_template_images/icon_minigender_ftm.gif"; $images['icon_minigender_neuter'] = "$current_template_images/icon_minigender_neuter.gif"; $images['icon_minigender_herm'] = "$current_template_images/icon_minigender_herm.gif"; ################################### This completes the changes in template_name.cfg ############################## # #-----[ ACTION ]------------------------------------------ # #MAKE FILES: #/templates/Theme_dirXX/icon_minigender_male.gif #/templates/Theme_dirXX/icon_minigender_female.gif #/templates/Theme_dirXX/icon_minigender_mtf.gif #/templates/Theme_dirXX/icon_minigender_ftm.gif #/templates/Theme_dirXX/icon_minigender_neuter.gif #/templates/Theme_dirXX/icon_minigender_herm.gif # make: /templates/Theme_dirXX/icon_minigender_male.gif /templates/Theme_dirXX/icon_minigender_female.gif /templates/Theme_dirXX/icon_minigender_mtf.gif /templates/Theme_dirXX/icon_minigender_ftm.gif /templates/Theme_dirXX/icon_minigender_neuter.gif /templates/Theme_dirXX/icon_minigender_herm.gif these files must be placed into each image directory used by all your themes. For example, if all you're using is the subSilver theme, then upload the two files to your phpBB2/templates/subSilver/images/ directory. Again, repeat this step for all your themes. #a link where to download samples files, is in the button of this post #(thanx to LChance) # #-----[ ACTION ]------------------------------------------ # #OPEN FILE: phpBB2/templates/template_dirXX/viewtopic_body.tpl (make sure you edit each occurrence of this file for all your themes). [FIND]: {postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}

[ADD AFTER]: {postrow.POSTER_GENDER}
################################### This completes the changes in viewtopic_body.tpl ##############################