I have created another block for my site, so I thought I'd post it here in case anyone was interested.
It shows the last 3 blog entries for each of the last 3 users who have posted blogs.
So not only does it show you some recent blogs, it also encourages people to blog more often (to get their name pushed up the list).
It's relatively simple to change it to show the last x entries by the last y users.
Anyway, here's the code:
global $user;
if (user_access("access content")) {
$blogs = "";
$queryResult = db_query_range("SELECT n.uid, u.name, max(n.nid) FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE n.type = 'blog' AND n.status = 1 GROUP BY n.uid, u.name ORDER BY 3 DESC", 0, 3);
while ($node = db_fetch_object($queryResult)) {
$blogs .= l(t("<h3>%username</h3>", array("%username" => $node->name)), "blog/$node->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))))
. node_title_list(db_query_range("SELECT n.title, n.nid FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = " . $node->uid . " ORDER BY n.nid DESC", 0, 3));
}
return $blogs
. "". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."
";
}