Browse code

Fix occasional foreach array to string conversion warning in author and coauthor URL handling function

Clarissa Walker authored on 2026/09/01 23:42:11
Showing 1 changed files
... ...
@@ -278,7 +278,7 @@ function title_link($stories) {
278 278
 
279 279
 // Same with the author list
280 280
 function author_link($stories) {
281
-	if(is_array($stories['coauthors'])) {
281
+	if ((!empty($stories['coauthors'])) && (is_array($stories['coauthors']))) {
282 282
 		$authlink[] = "<a href=\""._BASEDIR."viewuser.php?uid=".$stories['uid']."\">".$stories['penname']."</a>";
283 283
 		//not needed, why is it there?
284 284
 		//$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']."'");