URL to your eFiction: http://fannation.shades-of-moonlight.com/archive/
Version of eFiction: 3.4.3
Have you searched for your problem: Yes
If so, what terms did you try:"featured"
Do you have a test account for us? No
I am currently in the testing phase of my archive. I've added three stories and featured them according to the description I've given each story. I want my featured block on the front page to display the stories according to which of them was featured latest. I've set the settings so that fifteen stories will be shown in the featured block and I want to be able to continue to feature new stories without retiring the previous ones and only have the fifteen latest stories to be featured are listed.
Is this manageble with efiction?
Not without modifying the script. I haven't looked at the featured code, but I think it would be a lot of work. In any case, moving this along to the mod request forum.
I have tried looking at the Featured Block to see if I could make a modification to it, myself, but it was kinda difficult to decypher with all the constants, plus, one wrong move and I might end up upsetting the system for all I know.
You can't mess up the entire system by just editing the featured block files. That's good news, I guess...
No date is saved when a story is marked featured. You'd have to re-write that entire portion of the script.
No date is saved when a story is marked featured. You'd have to re-write that entire portion of the script.
Alright. Before I even attempt to make any changes, will it be safe for me to add a featured_date column to the fanfiction_stories table in the database? Or will my doing so crash the system?
adding a table in a database will not cause your system to crash, but it may also not get populated right and stay desperately empty until the right triggers are added, etc.
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
Just wanted to let you know I solved it, took some time and some hairpulling, but I managed in the end. In case anyone else is in my situation and wants to edit how their featured section is ordered, here's how to do it. But just as a disclaimer, there's probably more tidy ways of editing the SQL than what I did π
The database:
Open your efiction database and choose the table "fanfiction_stories" (it might have a prefix to it that you set during installation), add a new field at the bottom, fill out the forum with these values (and ignore the rest):
Field: featured_date
Type: DATETIME
Null: not null
Standard2/sup]: 0000-00-00 00:00:00
Displaying it correctly in a block:
Go to "blocks/featured/" and open "featured.php".
Find:
$query = dbquery(_STORYQUERY." AND stories.featured = '1'".($limit ? " LIMIT $limit" : ""));
Change to:
$query = dbquery("SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated, UNIX_TIMESTAMP(stories.featureddate) as featured_date FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 AND stories.featured = '1' ORDER BY featured_date DESC ".($limit ? " LIMIT $limit" : ""));
Displaying it correctly in the browse section:
Go to "browse/" and open "featured.php".
Find:
$numrows = search(_STORYQUERY.$storyquery._ORDERBY, _STORYCOUNT.$countquery, "browse.php?");
Change to:
$numrows = search("SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated, UNIX_TIMESTAMP(stories.featured_date) as featured_date FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ".$storyquery." ORDER BY featured_date DESC ", _STORYCOUNT.$countquery, "browse.php?");
To update the date field when featuring a story:
Go to the base folder and open "stories.php".
Find:
$updatequery = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET title = '".addslashes($title)."', summary = '".addslashes(format_story($summary))."', storynotes = '".addslashes(format_story($storynotes))."', rr = '".($rr ? 1 : 0)."', completed = '".($complete ? 1 : 0)."', validated = '$validated', rid = '$rid', classes = '".(is_array($classes) ? implode(",", $classes) : $classes)."', charid = '".(is_array($charid) ? implode(",", $charid) : $charid)."', catid = '".(is_array($catid) ? implode(",", $catid) : $catid)."', coauthors = '".(is_array($coauthors) ? implode(",", $coauthors) : $coauthors)."', featured = '$feat' WHERE sid = '$sid'");
Change to:
$featured_date_querybit = ($admin && $feat == 1) ? ", featured_date = NOW()" : "";
$updatequery = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET title = '".addslashes($title)."', summary = '".addslashes(format_story($summary))."', storynotes = '".addslashes(format_story($storynotes))."', rr = '".($rr ? 1 : 0)."', completed = '".($complete ? 1 : 0)."', validated = '$validated', rid = '$rid', classes = '".(is_array($classes) ? implode(",", $classes) : $classes)."', charid = '".(is_array($charid) ? implode(",", $charid) : $charid)."', catid = '".(is_array($catid) ? implode(",", $catid) : $catid)."', coauthors = '".(is_array($coauthors) ? implode(",", $coauthors) : $coauthors)."', featured = '$feat'$featured_date_querybit WHERE sid = '$sid'");
To update the date field when editing the feaured state in the admin options:
Go to "admin/" and open "featured.php".
Find:
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
Change to:
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1, featured_date = NOW() WHERE sid = ".$_GET['feature']);
