Limit Summary Length 7:25 pm Tags: eFiction, eFiction 3.0, limit summary length, PHP, Web Design Mood: na Description: Places a mandatory limit on how long a summary can be. If the summary exceeds the limit, the user is kicked back to the preview screen with the notice that they have to shorten their summary. Summary length is controlled in your admin settings, under "Submissions." If a limit is in place, a small notice appears above your summary field on story submissions notifying your users of the limit. If you turn it off, nothing appears. To turn it on, simply type in a length. (I suggest at least 750 - 1000 characters.) To turn it off, set it to 0. This was originally a 2.0 mod, but frankly -- it's a much easier, neater, and more sophisticated mod on 3.0. As usual, my line numbers are only there as a reference to put you in the general ballpark. They will likely change as you progress through the mod. This always bears repeating: Please be sure to backup your files and database before you begin this or any other mod. Requirements: eFiction 3.2.1 Difficulty: Easy - Intermediate (Depends on how well you follow my instructions.) Files Involved: admin/settings.php includes/storyform.php stories.php languages/en.php languages/en_admin.php 1 Database Modification Modification History: - 22 March, 2007 -- Mod Released Modification & Support: eFiction.org Instructions: Datbase Alteration: General information: (For phpMyAdmin, etc.) Table to Alter: fanfiction_settings Name: summarylimit Datatype: INT Length: 11 Null: Not Null Default: 0 After: minwords SQL Statement: PLAIN TEXT MySQL: ALTER TABLE `fanfiction_settings` ADD `summarylimit` INT( 11 ) NOT NULL DEFAULT '0' AFTER `minwords` ; Open: admin/settings.php Line 1; look for this: PLAIN TEXT PHP: "._STORIESPATH.": [?]"._HELP_STORIESPATH." AFTER the closing div tag, but BEFORE the semicolon, add this: PLAIN TEXT PHP:
[?]"._HELP_SUMMARYLIMIT."

Open: includes/storyform.php Line 1; look for this: PLAIN TEXT PHP: ".($preview && !$summary ? "*" : "")."
"; ABOVE that, add this: PLAIN TEXT PHP: // Limit Summary Length MOD -------- Inside that line, look for this: PLAIN TEXT PHP: ($preview && !$summary ? "*" : ""). After, add: PLAIN TEXT PHP: ($summarylimit ? ""._SUMMARYLIMIT."" : ""). Open: stories.php Line 1; look for this: PLAIN TEXT PHP: "._NAUGHTYWORDS; After add: PLAIN TEXT PHP: // Limit Summary Length MOD -------- if($summarylimit && strlen($summary)> "$summarylimit") $failed .= "
"._SUMMARYTOOLONG; Open: languages/en.php (or your language) Look for this at the bottom: PLAIN TEXT PHP: ?> BEFORE that, add this: PLAIN TEXT PHP: // Limit Summary Length MOD -------- define ("_SUMMARYLIMIT", "(Limit: $summarylimit characters)"); define ("_SUMMARYTOOLONG", "Your summary is too long. Summaries must be no longer than $summarylimit characters, including HTML and spaces."); Open: languages/en_admin.php (or your language) Look for this at the bottom: PLAIN TEXT PHP: ?> BEFORE that, add this: PLAIN TEXT PHP: // Limit Summary Length MOD -------- define ("_SUMLIMIT", "Maximum Summary Length"); define ("_HELP_SUMMARYLIMIT", "This allows you to set the maximum character count in summaries. This counts all characters including spaces, special characters, HTML, and regular text. Set this to 0 to impose no limits on summary length. Recommended: 750 - 1000 characters."); Save, upload, and enjoy!