Be sure to backup your database and files before you begin this or any other mod.
Description: This mod will put a male, female, or undisclosed icon in the author profile. I'll let you decide if undisclosed means "Not Telling" or just what. It is up to you to provide your own icons.
This mod was originally created for JanAQ as part of her requested profile mods.
I can't take full credit for this mod, I spent a lot of time trying to figure out how to get it working before I asked for help. Tammy replied and told me how to get it working.
As usual, my line numbers are approximate and only meant to put you in the general ballpark.
Requirements: eFiction 2.0
Difficulty: Easy
Modification History:
EDIT: Stopped working for some reason, so I changed the MYSQL declarations.
EDIT: Clarified my instructions for the database
EDIT: Changed my instructions so I didn't overwrite some of my other mods. If it's confusing, feel free to ask.
EDIT: Trying to fix the error Seiji found
EDIT: Tammy got it working! embarassed
EDIT: Fixed a typo from the instructions for line 389. Sorry!! embarassed
EDIT: Added the tpl tag
EDIT: 29 June 2006 -- Updated post format to match post requirements; also began an update to bring the mod up to the current version.
EDIT: 29 June 2006 -- Updated the modification to match the current release. Please let me know if you have any difficulties.
Files Involved:
- user.php
- viewuser.php
- languages/en.php
- user.tpl
Modification & Support Link: eFiction.org
Instructions:
Okay, make a new field in your authors table:
General Information (for phpMyAdmin, etc.)
- Table: fanfiction_authors
- Field: gender
- Datatype: char
- Length: 1
- Default: 0
- Null: Not Null
SQL Query:
-
ALTER TABLE `fanfiction_authors` ADD `gender` CHAR( 1 ) NOT NULL DEFAULT '0';
Open: user.php
Line 1, look for this:
-
<?php
After that, add this:
-
// Mod: Gender Field ----------------------------------
Line 375, look for this:
-
$query = "INSERT INTO ".$tableprefix."fanfiction_authors (penname, realname, bio, email, website, date, password, userskin, AOL, ICQ, MSN, Yahoo, contact, betareader, ageconsent, alertson) VALUES ('".addslashes($_POST['newpenname'])."', '".$_POST['realname']."', '".strip_tags(addslashes($_POST['bio']), $allowed_tags)."', '".strip_tags($_POST['email'], $allowed_tags)."', '".strip_tags($_POST['website'], $allowed_tags)."', now(), '$encryppass', '".$_POST['skinnew']."', '".strip_tags($_POST['AOL'], $allowed_tags)."', '".strip_tags($_POST['ICQ'], $allowed_tags)."', '".strip_tags($_POST['MSN'], $allowed_tags)."', '".strip_tags($_POST['Yahoo'], $allowed_tags)."', '".$_POST['ageconsent']."', '$newreviews', '$betareader', '$useralertson')";
Inside that, look for:
-
contact,
After, add:
-
gender,
Look for this:
-
'".strip_tags($_POST[email], $allowed_tags)."',
After that, add this
-
'".strip_tags($_POST[gender], $allowed_tags)."',
Next, go to line 394, look for this:
-
$query = "UPDATE ".$tableprefix."fanfiction_authors SET realname='".strip_tags(addslashes($_POST['realname']), $allowed_tags)."', password='$encryppassword', email='".$_POST['email']."', website='".strip_tags($_POST['website'], $allowed_tags)."', bio='".strip_tags(addslashes($_POST['bio']), $allowed_tags)."', image='$image', newreviews='$newreviews', userskin='".$_POST['skinnew']."', ageconsent='".$_POST['ageconsent']."', betareader='$betareader', AOL = '".strip_tags($_POST['AOL'], $allowed_tags)."', ICQ = '".strip_tags($_POST['ICQ'], $allowed_tags)."', MSN = '".strip_tags($_POST['MSN'], $allowed_tags)."', Yahoo = '".strip_tags($_POST['Yahoo'], $allowed_tags)."' WHERE uid = '".$_POST['uid']."'";
Inside that, look for this:
-
email='$_POST[email]',
After, add this:
-
gender='".strip_tags($_POST[gender], $allowed_tags)."',
Finally, go to 410 and look for this:
-
$update = "UPDATE ".$tableprefix."fanfiction_authors SET realname='".strip_tags(addslashes($_POST['realname']), $allowed_tags)."', email='".$_POST['email']."', website='".strip_tags($_POST['website'], $allowed_tags)."', bio='".strip_tags(addslashes($_POST['bio']), $allowed_tags)."', image='".$_POST['image']."', newreviews='$newreviews', userskin='".$_POST['skinnew']."', betareader='$betareader', alertson ='$useralertson', AOL = '".strip_tags($_POST['AOL'], $allowed_tags)."', ICQ = '".strip_tags($_POST['ICQ'], $allowed_tags)."', MSN = '".strip_tags($_POST['MSN'], $allowed_tags)."', Yahoo = '".strip_tags($_POST['Yahoo'], $allowed_tags)."', ageconsent = '".$_POST['ageconsent']."' WHERE uid = '".$_POST['uid']."'";
Inside that, look for this:
-
email='$_POST[email]',
After that, add this:
-
gender = '".strip_tags($_POST[gender], $allowed_tags)."',
Okay, enough of the mySQL declarations:
Go to line 427 and look for:
-
<tr><td colspan=\"2\">"._REALNAME.": <input type=\"text\" class=\"textbox=\" name=\"realname\" maxlength=\"200\" value=\"".$user['realname']."\"/></td></tr>
After it, add this:
-
// Gender Mod
-
<tr><td colspan=\"2\">"._GENDER.": <input type=\"radio\" class=\"radio\" value=\"2\" name=\"gender\" ".($user[gender] == 2 ? " checked" : "")."/> "._FEMALE." <input type=\"radio\" class=\"radio\" value=\"1\" ".($user[gender] == 1 ? " checked" : "")." name=\"gender\"/> "._MALE." <input type=\"radio\" class=\"radio\" value=\"0\" ".($user[gender] == 0 ? " checked" : "")." name=\"gender\"/> "._UNDISCLOSED."</td></tr>
Open viewuser.php
Line 1, look for this:
-
<?php
After that, add this:
-
// Mod: Gender Field ----------------------------------
Line 60, look for this:
-
if($userinfo[bio]) {
-
$tpl->assign("bio", stripinput($bio));
-
}
After that, add this:
-
// Gender Mod
-
if($userinfo[gender] == 0) $tpl->assign("gender", "<img src=\"images/Undisclosed.gif\" alt=\""._UNDISCLOSED."\"/>");
-
if($userinfo[gender] == 1) $tpl->assign("gender", "<img src=\"images/Male.gif\" alt=\""._MALE."\"/>");
-
if($userinfo[gender] == 2) $tpl->assign("gender", "<img src=\"images/Female.gif\" alt=\""._FEMALE."\"/>");
Open: languages/en.php (or your language)
At the end of the file, look for this:
-
?>
BEFORE that, add this:
Finally, open user.tpl and add {gender} whereever you want this mod to appear.
Save, upload, and enjoy!
|
|

