[MOD] Disable new s...
 
Notifications
Clear all

[MOD] Disable new story/new chapter for author after x chapters in queue.

3 Posts
3 Users
0 Reactions
1,629 Views
 Elle
(@jenny)
Posts: 594
Honorable Member
Topic starter
 

Description: If you have a limit on how many chapters an author can submit to the moderation queue, then this will ensure that the author cannot post more than the specified. This does not affect validated authors, or validated stories.

Requirements: eFic 3.5.1 (NB: This is what I'm using. This is pretty standardised, so it should work on lower versions!)

Mod History: 2009-08-06: release. πŸ™‚

Download Link: http://elyaeru.livejournal.com/216771.html (for archival use; slightly tutorial-esque tones)

Difficulty: Easy

Files: stories.php

---------------------

Find:

switch ($action) {

Select everything from there up until the closing bracket. (switch($action) { ... })

Replace with:

$checkvalid = dbquery("SELECT a.validated, count( chapid ) AS num FROM `".TABLEPREFIX."fanfiction_authorprefs` AS a LEFT JOIN `".TABLEPREFIX."fanfiction_chapters` AS c ON a.uid = c.uid WHERE a.uid = '".USERUID."' AND c.validated = '0' GROUP BY c.uid LIMIT 1");
$cv = dbassoc($checkvalid);

switch($action) {

case "newstory":
if($cv["validated"] == 0 && $cv["num"] >= 3)
 $output .= "<div id="pagetitle">Sorry...</div> <p>Sorry, you have reached the maximum number of slots in the queue. Please wait until your chapters have been validated before attempting to submit a new story. You may view the statuses of your chapters in <a href=""action=viewstories&amp;chapters=view"" title="Manage Stories">Manage Stories</a>. We apologise for the inconvenience.</p>";
else
 $output .= newstory( );
break;

case "newchapter":
 $storyvalid = dbquery("SELECT validated FROM `".TABLEPREFIX."fanfiction_stories` WHERE sid = '".escapestring($sid)."'");
 $sv = dbassoc($storyvalid);
 if($cv["validated"] == 0 && $cv["num"] >= 3 && $sv['validated'] == 0)
 $output .= "<div id="pagetitle">Sorry...</div> <p>Sorry, you have reached the maximum number of slots in the queue. Please wait until your chapters have been validated before attempting to submit a new story. You may view the statuses of your chapters in <a href=""action=viewstories&amp;chapters=view"" title="Manage Stories">Manage Stories</a>. We apologise for the inconvenience.</p>";
 else
  $output .= newstory( );
break;

case "editchapter":
$output .= editchapter($chapid);
break;
case "editstory":
$output .= editstory($sid);
break;
case "delete":
$output .= delete( );
break;
default:
$output .= viewstories( );
break;
}

Ideally: (a) The message should be placed into the relevant language file.

3 is set as the number of chapters allowed in the queue. You can edit this to how many you want. πŸ™‚

Also, if your eFic is bridged, you'll have to edit the query.

---

I've just tested it out on a demo archive; let me know if you run into any problems. πŸ™‚


archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 06/08/2009 5:15 pm
(@tammy)
Posts: 2577
Member Moderator
 

I don't think you need to check the author's validation status.  If they're validated they won't have chapters in the queue.  So you should be able to just count the number of chapters in the queue.


 
Posted : 07/08/2009 11:24 am
(@lyndsie)
Posts: 1263
Member Moderator
 

I have this running on my main site now and it seems pretty good. It's been there about five minutes, though, so the best I can say is that it hasn't broken anything. I tested it myself and it worked like it should. If any random problems crop up later I will come back and report them.


 
Posted : 18/08/2009 8:00 pm
Share: