12.Nov.2005

Description: This mod will place a link to your user's Live Journal Account in their author bio.

This mod assumes that your users do not have an underscore or dash at the beginning or end of their name, so you may wish to warn them.

As always my line numbers are approximate and meant to put you in the general ballpark. They will likely change as you progress through the mod.

Backup your files and database before you begin this or any other mod!

Requirements: eFiction 2.0

Difficulty: Easy

Mod History:
- 12 November, 2005, Mod Released
- 22 January, 2006, Updated to reflect LiveJournal changes

Files Involved:

  • user.php
  • viewuser.php
  • language/en.php

Modification & Support Link: eFiction.org

Instructions:

 

Database Modifications

General Information (for phpMyAdmin, etc.)

  • Table: fanfiction_authors
  • Field: LJ
  • Datatype: VARCHAR
  • Length: 40
  • Null: Not Null
  • Default: 0

SQL Query:

MySQL:
  1. ALTER TABLE `fanfiction_authors` ADD `LJ` VARCHAR(40) NOT NULL DEFAULT '0';

 

Open user.php:

Line 1, look for this:

PHP:
  1. <?php

After that, add this:

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

 

Around line 365 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 ('$_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 this:

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

After that, add this:

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

 

Go to line 390 or about, 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. Yahoo = '".strip_tags($_POST[Yahoo], $allowed_tags)."'

After that, add this: (Don't forget the comma!)

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

 

Find this: (Line 406)

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. Yahoo = '".strip_tags($_POST[Yahoo], $allowed_tags)."'

,

After, add this: (Don't forget the comma!)

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

 

Find: (Line 429)

PHP:
  1. <tr><td>"._MSN.": <input type=\"text\" class=\"textbox=\" name=\"MSN\"  value=\"".($user[MSN] ? $user[MSN] : "")."\" size=\"20\"/></td><td>"._YAHOO.": <input type=\"text\" class=\"textbox=\" name=\"Yahoo\"  value=\"".($user[Yahoo] ? $user[Yahoo] : "")."\" size=\"20\"/></td></tr>

After add:

PHP:
  1. // LiveJournal Mod
  2. <tr><td colspan=\"2\">"._LJ.": http:&frasl;&frasl;<input type=\"text\" class=\"textbox=\" name=\"LJ\"  value=\"".($user[LJ] ? $user[LJ] : "")."\" size=\"20\"/>.livejournal.com</td></tr>

 

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

PHP:
  1. <?php

After that, add this:

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

 

Find: (Line 74 or about)

PHP:
  1. $tpl->assign("msn", "<img src=\"images/msntalk.gif\" alt=\""._MSN."\"/> ".($userinfo[MSN] ? $userinfo[MSN] : _NONE));

Okay, now you get a choice: Either the incredible, vanishing LJ mod or the normal variety. The vanishing version will simply not return a link if there's nothing in the field. The normal will display it like eFiction 2.0 traditionally does.

For a Normal link:

After the MSN line add:

PHP:
  1. // LiveJournal Mod
  2. $tpl->assign("livejournal", $userinfo[LJ] ? "<img src=\"images/lj.gif\" alt=\""._LJ."\"/> <a href=\"http://$userinfo[LJ].livejournal.com\" target=\"_new\">$userinfo[LJ]</a>" : "<img src=\"images/lj.gif\" alt=\""._LJ."\"/> "._NONE);

For a link that doesn't appear if there's nothing in it:

After the MSN line add:

PHP:
  1. // LiveJournal Mod
  2. $tpl->assign("livejournal", $userinfo[LJ] ? "<img src=\"images/lj.gif\" alt=\""._LJ."\"/> <a href=\"http://$userinfo[LJ].livejournal.com\" target=\"_new\">$userinfo[LJ]</a>" : "");

 

Open: languages/en.php (or your langauge)
At the bottom of the file, look for this:

PHP:
  1. ?>

BEFORE that, add this:

PHP:
  1. // LiveJournal Mod
  2. define ("_LJ", "LiveJournal");

 

Now all you have to do is put {livejournal} on your user.tpl wherever you want it to appear.

 

I'll let you come up with an icon to link it to, since I'm terrible at pixel art. ^^;;

Anyway, save, upload, and enjoy!

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

Leave a Reply