Pārlūkot izejas kodu

Fixed list of disregarded topic in case of no disregarded - Thanks Spuds

Signed-off-by: emanuele <[email protected]>
emanuele 11 gadi atpakaļ
vecāks
revīzija
cfeb657b18
1 mainītis faili ar 28 papildinājumiem un 22 dzēšanām
  1. 28 22
      Sources/Profile-View.php

+ 28 - 22
Sources/Profile-View.php

@@ -627,12 +627,12 @@ function showAttachments($memID)
 /**
  * Get a list of attachments for this user
  *
- * @param type $start
- * @param type $items_per_page
- * @param type $sort
- * @param type $boardsAllowed
- * @param type $memID
- * @return type
+ * @param int $start
+ * @param int $items_per_page
+ * @param string $sort
+ * @param array $boardsAllowed
+ * @param ing $memID
+ * @return array
  */
 function list_getAttachments($start, $items_per_page, $sort, $boardsAllowed, $memID)
 {
@@ -879,28 +879,34 @@ function list_getDisregarded($start, $items_per_page, $sort, $memID)
 
 	$smcFunc['db_free_result']($request);
 
-	$request = $smcFunc['db_query']('', '
-		SELECT mf.subject, mf.poster_time as started_on, IFNULL(memf.real_name, mf.poster_name) as started_by, ml.poster_time as last_post_on, IFNULL(meml.real_name, ml.poster_name) as last_post_by, t.id_topic
-		FROM {db_prefix}topics AS t
-			INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
-			INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
-			LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
-			LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)
-		WHERE t.id_topic IN ({array_int:topics})',
-		array(
-			'topics' => $topics,
-		)
-	);
+	// Any topics found?
 	$topicsInfo = array();
-	while ($row = $smcFunc['db_fetch_assoc']($request))
-		$topicsInfo[] = $row;
-	$smcFunc['db_free_result']($request);
+	if (!empty($topics))
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT mf.subject, mf.poster_time as started_on, IFNULL(memf.real_name, mf.poster_name) as started_by, ml.poster_time as last_post_on, IFNULL(meml.real_name, ml.poster_name) as last_post_by, t.id_topic
+			FROM {db_prefix}topics AS t
+				INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
+				INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
+				LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
+				LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)
+			WHERE t.id_topic IN ({array_int:topics})',
+			array(
+				'topics' => $topics,
+			)
+		);
+		while ($row = $smcFunc['db_fetch_assoc']($request))
+			$topicsInfo[] = $row;
+		$smcFunc['db_free_result']($request);
+	}
 
 	return $topicsInfo;
 }
 
 /**
- * Count the topics in the disregarded list
+ * Count the number of topics in the disregarded list
+ *
+ * @param int $memID
  */
 function list_getNumDisregarded($memID)
 {