From 73ff627d44064944d770408fcf99906fe9b40702 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 6 Aug 2001 21:50:14 +0000 Subject: - Small updates: see mailing-list for details. --- modules/blog/blog.module | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'modules/blog/blog.module') diff --git a/modules/blog/blog.module b/modules/blog/blog.module index fa8f2fbf7..16fb062e8 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -71,12 +71,14 @@ function blog_page_user($name = 0, $date = 0) { $name = check_input($name ? $name : $user->userid); $date = check_input($date ? $date : time()); - $result = db_query("SELECT n.nid, n.title, n.comment, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id WHERE u.userid = '$name' AND n.timestamp < '$date' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id LEFT JOIN comments c ON n.nid = c.lid WHERE u.userid = '$name' AND n.timestamp < '$date' AND n.timestamp > '". ($date - 2592000) ."' GROUP BY n.nid ORDER BY n.nid DESC LIMIT 20"); $output .= ""; while ($blog = db_fetch_object($result)) { + $links = array(); + if ($date != date("dny", $blog->timestamp)) { $date = date("dny", $blog->timestamp); $output .= ""; @@ -87,18 +89,16 @@ function blog_page_user($name = 0, $date = 0) { } if ($user->id && user_access("post blogs")) { - $links[] = "nid\">". t("blog") .""; + $links[] = "nid\">". t("blog it") .""; } if ($blog->comment) { - $links[] = "nid\">". t("discuss") .""; + $links[] = "nid\">". format_plural($blog->comments, t("comment"), t("comments")) .""; } $output .= ""; $output .= ""; - unset($links); - } $output .= "
timestamp), date("d", $blog->timestamp), date("Y", $blog->timestamp)) ."\">". format_date($blog->timestamp, custom, "d M Y") .":
". check_output($blog->title) ."
". $theme->links($links) ."
". check_output($blog->body, 1) ."

"; @@ -110,12 +110,14 @@ function blog_page_user($name = 0, $date = 0) { function blog_page_last() { global $theme, $user; - $result = db_query("SELECT n.author, n.nid, n.title, n.comment, n.timestamp, b.body, u.userid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id ORDER BY b.lid DESC LIMIT 20"); + $result = db_query("SELECT n.author, n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.userid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid ORDER BY n.nid DESC LIMIT 20"); $output .= ""; while ($blog = db_fetch_object($result)) { + $links = array(); + $links[] = "userid) ."\">". strtr(t("%a's blog"), array("%a" => $blog->userid)) .""; if ($blog->author == $user->id) { @@ -123,17 +125,16 @@ function blog_page_last() { } if ($user->id && user_access("post blogs")) { - $links[] = "nid\">". t("blog") .""; + $links[] = "nid\">". t("blog it") .""; } if ($blog->comment) { - $links[] = "nid\">". t("discuss") .""; + $links[] = "nid\">". format_plural($blog->comments, t("comment"), t("comments")) .""; } $output .= ""; $output .= ""; - unset($links); } $output .= "
". check_output($blog->title) ."". $theme->links($links) ."
". check_output($blog->body, 1) ."

"; -- cgit v1.2.3