From a6a47a32572c3b71d0c6cf1a2918c0f9d6f8213b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 9 Nov 2002 16:24:46 +0000 Subject: - Applied Moshe's "theme head" patch: "This patch to theme.inc adds the ability for modules to insert HTML into the section of all web pages. The additional modules in this directory [ed: blog.module] demonstate possible uses for the new _head() hook." --- modules/blog/blog.module | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'modules/blog') diff --git a/modules/blog/blog.module b/modules/blog/blog.module index b603884fc..865bdbe87 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -6,7 +6,6 @@ function blog_system($field){ return $system[$field]; } - function blog_conf_options() { $output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 55, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.")); $words = t("words"); @@ -45,6 +44,16 @@ function blog_access($op, $node) { } +function blog_head($main = 0) { + global $id, $mod; + + if ($mod && $id) { + $account = user_load(array("uid" => $id)); + $output[] = "name. "'s blog\" href=\"". path_uri(). "module.php?mod=blog&op=view&id=$id\" />"; + } + return $output ? $output : array(); +} + function blog_user($type, &$edit, &$user) { switch ($type) { case "view_public": @@ -92,7 +101,6 @@ function blog_save($op, $node) { } - function blog_help() { ?>

Drupal's blog module allows registered users to maintain an online blog, often referred to as an online journal or diary. They can be filled with daily thoughts, poetry, boneless blabber, spiritual theories, intimate details, valuable experiences, cynical rants, semi-coherent comments, writing experiments, artistic babblings, critics on current facts, fresh insights, diverse dreams, chronicles and mumbling madness available for public consumption. It is made up of individual entries that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen, or agree/disagree with. A typical example of a long term blog can be seen at http://www.scripting.com/.

@@ -117,37 +125,21 @@ function blog_feed_user($uid = 0, $date = 0) { } $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.created > '". ($date - 2592000) ."' ORDER BY n.nid DESC LIMIT 15"); - while ($blog = db_fetch_object($result)) { - $items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser); - } - $output .= "\n"; - // $output .= "\n"; - $output .= "\n"; - $output .= format_rss_channel("$account->name's blog", path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => $account->uid), "module"), "$account->name's blog", $items); - $output .= "\n"; - - header("Content-Type: text/xml"); - - print $output; + $channel["title"] = $account->name. "'s blog"; + $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view", "id" => $uid), "module"); + $channel["description"] = $term->description; + node_feed($result, $channel); } function blog_feed_last() { $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 15"); - while ($blog = db_fetch_object($result)) { - $items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser); - } - - $output .= "\n"; - $output .= "\n"; - $output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() . drupal_url(array("mod" => "blog"), "module"), "Recently updated blogs.", $items); - $output .= "\n"; - - header("Content-Type: text/xml"); - - print $output; + $channel["title"] = variable_get("site_name", "drupal"). "blogs"; + $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view"), "module"); + $channel["description"] = $term->description; + node_feed($result, $channel); } -- cgit v1.2.3