[MOD] Limit Summary...
 
Notifications
Clear all

[MOD] Limit Summary Length

2 Posts
2 Users
0 Reactions
4,864 Views
(@lazuli)
Posts: 61
Trusted Member
Topic starter
 

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.

I think I got everything that handles the summary, but don't quote me on that.  I'm still learning the 3.0 files.

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

Project Link: http://sally.lunaescence.com/2007/03/22/limit-summary-length/

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:

ALTER TABLE `fanfiction_settings` ADD `summarylimit` INT( 11 ) NOT NULL DEFAULT '0' AFTER `minwords` ;

Open: admin/settings.php
Line 1; look for this:

<?php

After add this:

// Mod: Limit Summary Length ----------------------------------

Look for this: (Line 110)

$maxwords = isNumber($_POST['newmaxwords']) ? $_POST['newmaxwords'] : 0;

After that, add this:

	// Limit Summary Length MOD --------
$summarylimit = isNumber($_POST['newsummarylimit']) ? $_POST['newsummarylimit'] : 0;

Look for this: (line 121)

$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET submissionsoff = '$submissionsoff', autovalidate = '$autovalidate', coauthallowed = '$coauthallowed', store = '$store', storiespath = '$storiespath', minwords = '$minwords', maxwords = '$maxwords', imageupload = '$imageupload', imageheight = '$imageheight', imagewidth = '$imagewidth', roundrobins = '$roundrobins', allowseries = '$allowseries' WHERE sitekey = '$sitekey'");

Inside that, look for

maxwords = '$maxwords',

After that, add this:

summarylimit = '$summarylimit',

Look for this: (line 257)

<label for="newstoriespath">"._STORIESPATH.": </label> <INPUT  type="text" class="textbox=" name="newstoriespath" value="$storiespath"> <A HREF=""#"" class="pophelp">[?]<span>"._HELP_STORIESPATH."</span></A></div>

AFTER the closing div tag, but BEFORE the semicolon, add this:

<!-- Limit Summary Length MOD -->
<div><label for="newsummarylimit">"._SUMLIMIT.": </label> <INPUT  type="text" class="textbox=" name="newsummarylimit" value="$summarylimit" size="7"> <A HREF=""#"" class="pophelp">[?]<span>"._HELP_SUMMARYLIMIT."</span></A><br /><br /></div>

Open: includes/storyform.php
Line 1; look for this:

<?php

After add this:

// Mod: Limit Summary Length ----------------------------------

Line 33, look for this:

global $admin, $allowed_tags, $multiplecats, $tableprefix, $useruid, $roundrobins, $catlist, $adminloggedin, $coauthallowed, $tinyMCE, $action, $sid;

Inside that, look for

$allowed_tags,

After that, add this:

$summarylimit,

Look for this: (Line 70)

$output .= "<p><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>";

ABOVE that, add this:

// Limit Summary Length MOD --------

Inside that line, look for this:

($preview && !$summary ? "<span style="font-weight: bold; color: red">*</span>" : "").

After, add: (Be sure it's after the period!)

($summarylimit ? ""._SUMMARYLIMIT."" : "").

Open: stories.php
Line 1; look for this:

<?php

After add this:

// Mod: Limit Summary Length ----------------------------------

Find: (Line 76)

	global $autovalidate, $sid, $action, $sid, $store, $tpl, $storiespath, $admin, $sitename, $siteemail, $allowed_tags, $level, $admincats, $alertson, $dateformat, $url, $tableprefix, $minwords, $maxwords, $useruid, $userpenname, $charlist, $catlist, $classtypelist;

Inside that, look for this:

$maxwords,

After that, add:

$summarylimit,

Find: (Line: 140)

if(find_naughty($title)) $failed .= "<br />"._NAUGHTYWORDS;

After add:

	// Limit Summary Length MOD --------
if($summarylimit && strlen($summary) > "$summarylimit") $failed .= "<br />"._SUMMARYTOOLONG;

Open: languages/en.php (or your language)

Look for this at the bottom:

?>

BEFORE that, add this:

// Limit Summary Length MOD --------
define ("_SUMMARYLIMIT", "<small>(Limit: $summarylimit characters)</small>");
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:

?>

BEFORE that, add this:

// 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!


I'm sorry, but due to my schedule, I am not available for commissions.

Blog | DA Account

 
Posted : 22/03/2007 7:19 pm
(@mistressmalfoy)
Posts: 44
Eminent Member
 

My storyform.php does not have this line included

($preview && !$summary ? "<span style="font-weight: bold; color: red">*</span>" : "").


 
Posted : 11/09/2011 1:49 am
Share: