A weird bug that involves Coauthors, here is what you need:
The original author (Author A) adds a story with Coauthors (Author B, Author C).
The story shows up correctly on Authors B and C, but on Author A, it is listed twice.
This is due to the query using a JOIN to Coauthors, so it duplicates the rows multiple times.
user/storiesby.php:
$storyquery = dbquery("SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON coauth.sid = stories.sid WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 AND (stories.uid = '$uid' OR coauth.uid = '$uid') "._ORDERBY." LIMIT $offset, $itemsperpage");
An IN clause is better suited for this:
$storyquery = dbquery("SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 AND (stories.uid = '$uid' OR stories.sid in (SELECT sid FROM fanfiction_coauthors WHERE uid = '$uid')) "._ORDERBY." LIMIT $offset, $itemsperpage");
I hope this helps,
~ Foz
Making your specified changes gives me this error when I visit the bio of a coauthor:
A fatal MySQL error was encountered.
Query: SELECT stories.*, author.penname as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM (efictionfanfiction_authors as author, efictionfanfiction_stories as stories) WHERE author.uid = stories.uid AND stories.validated > 0 AND (stories.uid = '65817' OR stories.sid in (SELECT sid FROM fanfiction_coauthors WHERE uid = '65817')) ORDER BY updated DESC LIMIT 0, 20
Error: (1146) Table 'fanfiction_data.fanfiction_coauthors' doesn't exist
I don't see anything wrong with your specification of the fanfiction_coauthors table and have no idea why the table prefix is picking up on our fanfiction_data prefix rather than our efiction one.
EDIT: Manually changed fanfiction_coauthors to reflect our own table prefix. However, I see no change: example
Can you please check and see if this is still an issue with 3.5? Thank you!
Whoever said nothing is impossible never tried slamming a revolving door.
url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word
I just had to apply this particular fix to my copy of 3.5, so it seems to still be an issue. The fix solved things wonderfully, though.