Description: This mod adds a manditory disclaimer field to every story form. If users do not fill in the disclaimer, they'll receive an error just like if they left the summary or title blank.
This mod is as involved as my story type mod, if not a bit moreso, due to the fact that it has to be made manditory. I strongly suggest you read through my instructions before you actually attempt this modification.
For this mod, I used files from the latest release. (2.0.7, 28 Aug 2006 patch) The line numbers are all approximate and will likely change as you progress through this mod. Please consider them simply a guide to put you into the general area.
This mod is UNTESTED. In theory it should work, but I have not tested it on my own site.
Requirements: eFiction 2.0.7 (28 Aug. 2006 Patch)
Difficulty: Advanced
Mod History:
18 Sept 2006 -- Mod created as per request by fanfiction world
Files Involved:
- Database modification
- stories.php
- viewstory.php
- languages/YOUR LANGUAGE.php
- skins/YOUR SKIN/viewstory.tpl
Modification & Support Link: eFiction.org
Instructions:
Database Modifications
This mod calls for a database mod. You need to modify your fanfiction_stories table in order to accept the new field.
General Information (for phpMyAdmin, etc.)
- Field Name: disclaimer
- Datatype: text
- Null: NOT NULL
- After: summary
SQL Statement:
-
ALTER TABLE `fanfiction_stories` ADD `disclaimer` TEXT NOT NULL AFTER `summary`
This is the messy and vital part of this mod. If you haven't already, please make certain you have stories.php backed up. A lot can go wrong when modifying this file.
In this file, we're basically copying almost every instance of summary and renaming them to disclaimer.
Open: stories.php.
On line 1, look for this:
-
<?php
Below that, add:
-
// -- MOD: Disclaimer Field ----------------------------------------------
On line 89, look for this:
-
function storyform($title, $summary, $rr, $complete, $rid, $wid, $gid, $charid, $catid, $featured, $uid, $preview = 0){
Inside that, look for:
-
$summary,
After add:
-
$disclaimer,
On line 108, look for this:
-
$output .= "<label for=\"summary\">"._SUMMARY.":</label> ".($preview && !$summary ? "<span style=\"font-weight: bold; color: red\">*</span>" : "")."<br /><textarea class=\"textbox\" rows=\"6\" name=\"summary\" id=\"summary\" cols=\"58\">$summary</textarea>";
Inside that, look for:
-
[/php]
-
-
-
After that, add:
-
-
[php]// -- MOD: Disclaimer -------------------------
-
<label for=\"disclaimer\">"._DISCLAIMER.":</label> ".($preview && !$disclaimer ? "<span style=\"font-weight: bold; color: red\">*</span>" : "")."<br /><textarea class=\"textbox\" rows=\"6\" name=\"disclaimer\" id=\"disclaimer\" cols=\"58\">$disclaimer</textarea>
-
// -- END: Disclaimer -------------------------
On line 229, look for this:
-
if($_POST['summary'] ) $summary = replace_naughty(stripinput(strip_tags($_POST['summary'], $allowed_tags)));
After, add:
-
// -- MOD: Disclaimer -------------------------
-
if($_POST['disclaimer'] ) $disclaimer = replace_naughty(stripinput(strip_tags($_POST['disclaimer'], $allowed_tags)));
-
// -- END: Disclaimer -------------------------
On line 278, look for:
-
if($_POST[submit] == _ADDSTORY && ((!$newchapter && (!$rid || !$title || !$summary || !$catid) || $storytext == "")))
Inside that, look for:
-
|| !$summary
After, add:
-
|| !$disclaimer
On line 282, look for:
-
if(!$newchapter && ($rid == "" || $title == "" || $summary == "" || !$catid)) $failed .= "<br />". _MISSINGFIELDS;
Inside that, look for:
-
|| $summary == ""
After, add:
-
|| $disclaimer == ""
On line 286, look for:
-
$story = mysql_query("SELECT sid, catid, title, summary FROM ".$tableprefix."fanfiction_stories WHERE sid = '".$_GET['sid']."'");
Inside that, look for:
-
, summary
After, add:
-
, disclaimer
On line 289, look for:
Inside that, look for:
-
$summary
After, add:
-
, $disclaimer
On line 316, look for:
-
$insertquery = "INSERT INTO ".$tableprefix."fanfiction_stories (title, summary, catid, gid, charid, wid, rid, date, updated, uid, validated, rr, completed, wordcount, featured) VALUES ('".addslashes($title)."', '".addslashes(nl2br($summary))."', '$categories', '".($gid ? implode(",", $gid) : "")."', '".addslashes($charstring)."', '".($wid ? implode(",", $wid) : "")."', '$rid', now(), now(), '$uid', '$validated', '$rr', '$complete', '$wordcount', '$featured')";
Inside that, look for:
-
summary,
After that, add:
-
disclaimer,
Further down, same line, look for:
-
'".addslashes(nl2br($summary))."',
After, add:
-
'".addslashes(nl2br($disclaimer))."',
On line 331, look for:
-
$insertstory = mysql_query("INSERT INTO ".$tableprefix."fanfiction_stories (title, summary, catid, gid, charid, wid, rid, date, updated, uid, validated, rr, completed, wordcount, featured) VALUES ('".addslashes($title)."', '".addslashes(nl2br($summary))."', '$categories', '".addslashes($genrestring)."', '".addslashes($charstring)."', '".addslashes($warningstring)."', '$rid', now(), now(), '$uid', '$validated', '$rr', '$complete', '$wordcount', '$featured')") or die(_FATALERROR." Could not insert story into stories table.<br />Error: (".mysql_errno( ).") ".mysql_error( ));
Inside that, look for:
-
summary,
After, add:
-
disclaimer,
Further down, same line, look for:
-
'".addslashes(nl2br($summary))."',
After, add:
-
'".addslashes(nl2br($disclaimer))."',
Line 425, look for:
-
$storyinfo = mysql_query("SELECT title, summary, gid, wid, charid, rid, catid FROM ".$tableprefix."fanfiction_stories where sid = '".$_GET['sid']."' LIMIT 1");
Inside that, look for:
-
summary,
After, add:
-
disclaimer,
Line 428, look for:
-
$summary = $info['summary'];
After, add:
-
// -- MOD: Disclaimer -------------------------
-
$disclaimer = $info['disclaimer'];
-
// -- END: Disclaimer -------------------------
Line 452, look for:
-
"<strong>"._SUMMARY.": </strong>$summary<br />
After add:
-
<strong>"._DISCLAIMER.": </strong>$disclaimer<br />
Line 463, look for:
-
if(!$newchapter) $output .= storyform($title, $summary, $rr, $complete, $rid, $wid, $gid, $charid, $catid, $featured, $uid, $preview);
Inside that, look for:
-
$summary,
After, add:
-
$disclaimer,
Line 646, look for:
After, add:
-
// -- MOD: Disclaimer -------------------------
-
// -- END: Disclaimer -------------------------
Line 658, look for:
-
if (!$rid || $title == "" || $summary == "" || !$catid) {
Inside that, look for:
-
|| $summary == ""
After that, add:
-
|| $disclaimer == ""
Line 702, look for:
-
$updatequery = "UPDATE ".$tableprefix."fanfiction_stories SET title = '".addslashes($title)."', summary = '".addslashes(nl2br($summary))."', rr = '".($rr ? 1 : 0)."', completed = '".($completed ? 1 : 0)."', rid = '$rid', gid = '".(is_array($gid) ? addslashes(implode(",", $gid)) : $gid)."', wid = '".(is_array($wid) ? addslashes(implode(",", $wid)) : $wid)."', charid = '".(is_array($charid) ? addslashes(implode(",", $charid)) : $charid)."', catid = '".(is_array($catid) ? implode(",", $catid) : $catid)."', featured = '$featured' WHERE sid = '$sid'";
Inside that, look for:
-
summary = '".addslashes(nl2br($summary))."',
After, add:
-
disclaimer = '".addslashes(nl2br($disclaimer))."',
Line 715, look for:
-
$query = "SELECT title, summary, rr, completed, rid, wid, gid, charid, catid, featured, uid FROM ".$tableprefix."fanfiction_stories WHERE sid = '$sid' LIMIT 1";
Inside that, look for:
-
summary,
After, add:
-
disclaimer,
Line 718, look for:
-
$output .= storyform(stripinput($story['title']), stripinput($story['summary']), $story['rr'], $story['completed'], stripinput($story['rid']), explode(",", stripinput($story['wid'])), explode(",", stripinput($story['gid'])), explode(",",stripinput($story['charid'])), explode(",", $story['catid']), $story['featured'], $story['uid'], $preview);
Inside that, look for:
-
stripinput($story['summary']),
After, add:
-
stripinput($story['disclaimer']),
Line 733, look for:
-
<strong>"._SUMMARY.": </strong>".($tinyMCE ? $summary : nl2br($summary))."<br /><br />";
Inside that, look for:
-
<br /><br />
After that, add this:
-
// -- MOD: Disclaimer -------------------------
-
<strong>"._DISCLAIMER.": </strong>".($tinyMCE ? $disclaimer : nl2br($disclaimer))."<br /><br />
-
// -- MOD: Disclaimer -------------------------
Line 734, look for:
-
$output .= storyform($title, $summary, $rr, $completed, $rid, $wid, $gid, $charid, $catid, $featured, $_POST['uid'], $submit);
Inside that, look for:
-
$summary,
After, add:
-
$disclaimer,
Open: viewstory.php.
On line 1, look for this:
-
<?php
Below that, add:
-
// -- MOD: Disclaimer Field ----------------------------------------------
Line 122, look for this:
-
_SUMMARY.": ".$story['summary']."<br /><strong>".
After, add:
-
// -- MOD: Disclaimer -------------------------
-
_DISCLAIMER.":</strong> ".$story['disclaimer']."<br /><strong>".
-
// -- END: Disclaimer -------------------------
Line 300, look for this:
-
$tpl->assign("summary", $storyinfo['summary']);
After, add:
-
// -- MOD: Disclaimer -------------------------
-
$tpl->assign("disclaimer", $storyinfo['disclaimer']);
-
// -- END: Disclaimer -------------------------
Open: languages/en.php (or your language file)
Line 222, look for this:
-
define ("_MISSINGFIELDS", "Some of the required information is missing. Please check your input. Required fields are title, summary, ".(!$numcats ? strtolower(_CATEGORY.", ") : "")."rating, and story text."); // Modified 02/04/06 added strtolower to convert category to lower case
Change to:
-
define ("_MISSINGFIELDS", "Some of the required information is missing. Please check your input. Required fields are title, summary, disclaimer, ".(!$numcats ? strtolower(_CATEGORY.", ") : "")."rating, and story text."); // Modified 18 Sept. 2006 added disclaimer field to required list
Finally, at the bottom, or wherever it'll be most convenient, add:
Open: skins/YOUR SKIN/viewstory.tpl.
Add {disclaimer} to make the disclaimer display on your story pages.
Save, upload, and enjoy!
|
|

