29.Sep.2006

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:

MySQL:
  1. ALTER TABLE `fanfiction_authors` ADD `gender` CHAR( 1 ) NOT NULL DEFAULT '0';

 

 

 

 

 

 

Open: user.php
Line 1, look for this:

PHP:
  1. <?php

After that, add this:

PHP:
  1. // Mod: Gender Field ----------------------------------

 

 

Line 375, look for this:

PHP:
  1. $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:

PHP:
  1. contact,

After, add:

PHP:
  1. gender,

Look for this:

PHP:
  1. '".strip_tags($_POST[email], $allowed_tags)."',

After that, add this

PHP:
  1. '".strip_tags($_POST[gender], $allowed_tags)."',

 

 

Next, go to line 394, look for this:

PHP:
  1. $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:

PHP:
  1. email='$_POST[email]',

After, add this:

PHP:
  1. gender='".strip_tags($_POST[gender], $allowed_tags)."',

 

 

Finally, go to 410 and look for this:

PHP:
  1. $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:

PHP:
  1. email='$_POST[email]',

After that, add this:

PHP:
  1. gender = '".strip_tags($_POST[gender], $allowed_tags)."',

 

 

Okay, enough of the mySQL declarations:

 

 

Go to line 427 and look for:

PHP:
  1. <tr><td colspan=\"2\">"._REALNAME.": <input type=\"text\" class=\"textbox=\" name=\"realname\" maxlength=\"200\" value=\"".$user['realname']."\"/></td></tr>

After it, add this:

PHP:
  1. // Gender Mod
  2. <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:
  1. <?php

After that, add this:

PHP:
  1. // Mod: Gender Field ----------------------------------

 

 

Line 60, look for this:

PHP:
  1. if($userinfo[bio]) {
  2.         $bio = nl2br($userinfo[bio]);   
  3.         $tpl->assign("bio", stripinput($bio));
  4.     }

After that, add this:

PHP:
  1. // Gender Mod
  2. if($userinfo[gender] == 0) $tpl->assign("gender", "<img src=\"images/Undisclosed.gif\" alt=\""._UNDISCLOSED."\"/>");
  3.     if($userinfo[gender] == 1) $tpl->assign("gender", "<img src=\"images/Male.gif\" alt=\""._MALE."\"/>");
  4.     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:

PHP:
  1. ?>

BEFORE that, add this:

PHP:
  1. // Gender Mod
  2. define ("_GENDER", "Gender");
  3. define ("_MALE", "Male");
  4. define ("_FEMALE", "Female");
  5. define ("_UNDISCLOSED", "Not Telling!");

 

 

Finally, open user.tpl and add {gender} whereever you want this mod to appear.

 

 

Save, upload, and enjoy!

You can leave a response, or trackback from your own site.

Leave a Reply