Fix occasional foreach array to string conversion warning in author and coauthor URL handling function
--- a/includes/corefunctions.php
+++ b/includes/corefunctions.php
@@ -278,7 +278,7 @@
// Same with the author list
function author_link($stories) {
- if(is_array($stories['coauthors'])) {
+ if ((!empty($stories['coauthors'])) && (is_array($stories['coauthors']))) {
$authlink[] = "<a href=\""._BASEDIR."viewuser.php?uid=".$stories['uid']."\">".$stories['penname']."</a>";
//not needed, why is it there?
//$coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$stories['sid']."'");