URL to your eFiction: http://fannation.shades-of-moonlight.com/archive/toplists.php?list=prolificauthors
Version of eFiction: 3.4.3
Have you bridged eFiction, if so with what?:
Version of PHP: support for both 4 and 5, so not sure
Version of MySQL: 5-something
Have you searched for your problem: yes
If so, what terms did you try: "prolific wordcount" "top tens"
State the nature of your problem:
Currently Top Ten Profilic authors is set by the number of stories each author has written, but considering my archive will consist of stories of all lengths, it hardly seems fair that someone with 30 stories of 1000-3000 words each should outrank another author whose 5 stories are more in the 40,000-50,000 word variety. So I want to change the Top Ten Prolific authors to go by word count, so that whether an author has many stories or a few, it's the total content of all stories that counts.
I know that the key here lies in the select statement to the database, but I don't have a good enough overview of the database to alter this on my own. Plus it's been a few years since I last touched SQL, so has anyone here made this alternation to their prolific authors list?
Do you have a test account for us? no
Update, I think I've solved the problem.
I went to the default.php file in the toplist/ folder and switched the following code:
case "prolificauthors":
$result = dbquery("SELECT ap.stories AS count, "._PENNAMEFIELD."
as penname , "._UIDFIELD." as uid FROM ".TABLEPREFIX."fanfiction_authorprefs as ap LEFT
JOIN "._AUTHORTABLE." ON ap.uid = "._UIDFIELD." ORDER BY count DESC LIMIT 10");
if(dbnumrows($result) == 0) $output .= write_message(_NORESULTS);
$count = 1;
while($author = dbassoc($result)) {
$output .= "$count. <a href=""viewuser.php?uid="."
$author['uid']."">".$author['penname']."</a> [".$author['count']."]<br /> ";
$count++;
}
break;
with
case "prolificauthors":
$result = dbquery("SELECT sum(stories.wordcount) as wcount,
count(stories.sid) as count, authors.penname as penname , stories.uid as uid FROM ".
TABLEPREFIX."fanfiction_stories as stories, ".TABLEPREFIX."fanfiction_authors as authors
WHERE authors.uid = stories.uid GROUP BY uid ORDER BY wcount DESC LIMIT 10");
if(dbnumrows($result) == 0) $output .= write_message(_NORESULTS);
$count = 1;
while($author = dbassoc($result)) {
$output .= "$count. <a href=""viewuser.php?uid="."
$author['uid']."">".$author['penname']."</a> [".$author['wcount']."]<br /> ";
$count++;
}
break;
The code will only show authors with submissions, but who wants authors with no submissions in the top ten prolific authors?
I have been wanting something like this, as well. Just a note to anyone else doing this, it is possible to have both lists. This is how I did it:
toplist/default.php:
Around line 86, add below:
case "prolificauthors":
$result = dbquery("SELECT ap.stories AS count, "._PENNAMEFIELD." as penname , "._UIDFIELD." as uid FROM ".TABLEPREFIX."fanfiction_authorprefs as ap LEFT JOIN "._AUTHORTABLE." ON ap.uid = "._UIDFIELD." ORDER BY count DESC LIMIT 20");
if(dbnumrows($result) == 0) $output .= write_message(_NORESULTS);
$count = 1;
while($author = dbassoc($result)) {
$output .= "$count. <a href=""viewuser.php?uid=".$author['uid'"]."">".$author['penname']."</a> [".$author['count']."]<br /> ";
$count++;
}
break;
Add (note change in what the panel is called):
case "wordcountauthors":
$result = dbquery("SELECT sum(stories.wordcount) as wcount, count(stories.sid) as count, authors.penname as penname , stories.uid as uid FROM ".TABLEPREFIX."fanfiction_stories as stories, ".TABLEPREFIX."fanfiction_authors as authors WHERE authors.uid = stories.uid GROUP BY uid ORDER BY wcount DESC LIMIT 20");
if(dbnumrows($result) == 0) $output .= write_message(_NORESULTS);
$count = 1;
while($author = dbassoc($result)) {
$output .= "$count. <a href=""viewuser.php?uid=".$author['uid'"]."">".$author['penname']."</a> [".$author['wcount']."]<br /> ";
$count++;
}
break;
Then go to your phpMyAdmin, and insert the following SQL string (hope I wrote this part out right). Be sure to change the prefix of your "fanfiction_panels" to reflect whatever yours may be:
INSERT INTO `fanfiction_panels` (`panel_id`, `panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES
(110, 'wordcountauthors', '10 Most Prolific Authors By Word-Count', 'toplists/default.php', 0, 13, 0, 'L');
You can also do the above by going to the "fanfiction_panels", clicking "Insert" and manually typing in the information. Whichever you feel most comfortable with. π
You may want to change the order the listings show up as on the Top Ten main page. For me, I changed the order to:
Order 9 - 10 Most Prolific Authors By Story-Count <-- I edited this name on the Efiction side by going to the Admin/Panels area)
Order 10 - 10 Most Prolific Authors By Word-Count
Order 11 - 10 Most Favorite Authors
Order 12 - 10 Most Prolific Reviewers
Order 13 - 10 Top Challenges
To do this, go to phpMyAdmin, then go to "fanfiction_panels", then click on "Browse". Find the correct panel and edit the field "panel_order".
As an aside, in toplist/default.php you can also change the top 10 to whatever you want by changing "DESC LIMIT 10". Personally, I have it all set up as a Top 20. π
Julieann
Running 3.4.3 bridged with SMF and Coppermine
Mods: Challenges, cpg-art (not working), Limit Summary Length, Bio to Prefs, Top 20 instead of 10
Wants: Move Betareader to Prefs, Twitter
