summaryrefslogtreecommitdiff
path: root/modules/blog.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/blog.module')
-rw-r--r--modules/blog.module59
1 files changed, 36 insertions, 23 deletions
diff --git a/modules/blog.module b/modules/blog.module
index 0e3891b5e..7e7eca288 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -68,9 +68,9 @@ function blog_help($section) {
<p>Blogs are made up of individual entries (nodes) that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen and/or agree/disagree with. A typical example of a long term blog can be seen at %scripting-com.</p>
<p>The blog module adds a \"user blogs\" navigation link to the site, which takes any visitor to a page that displays the most recent blog entries from all the users on the site. Personal user menus gain a \"create a blog entry\" link (which takes you to a submission form) and a \"view personal blog\" link (which displays your blog entries as other people will see them). On the bottom of each of your own blog entries, there is an \"edit this blog entry\" link that lets you edit or delete that entry.</p>
<p>If a user has the ability to post blogs, then the import module (news aggregator) will display a blog-it link <strong>(b)</strong> next to each news item in its lists. Click on this and you will be taken to the blog submission form, with the title, a link to the item, and a link to the source into the body text already in the text box, ready for you to add your explanation. This actively encourages people to add blog entries about things they see and hear elsewhere in the Drupal site and from your syndicated partner sites.</p>", array('%scripting-com' => '<a href="http://www.scripting.com/">http://www.scripting.com/</a>'));
- case 'admin/system/modules#description':
+ case 'admin/modules#description':
return t('Enables keeping a blog or easily and regularly updated web page.');
- case 'admin/system/modules/blog':
+ case 'admin/settings/blog':
return t("A weblog is a running journal of a user's ideas. Enter the minimum word count for a single entry, and the text displayed on the entry submission form");
case 'node/add/blog':
return variable_get('blog_help', '');
@@ -201,7 +201,7 @@ function blog_form(&$node, &$error) {
*/
if ($nid && $blog = node_load(array('nid' => $nid))) {
- $node->body = '<i>'. $blog->body .'</i> ['. l($blog->name, "node/view/$nid") .']';
+ $node->body = '<i>'. $blog->body .'</i> ['. l($blog->name, "node/$nid") .']';
}
if ($iid && $item = db_fetch_object(db_query('SELECT i.*, f.title as ftitle, f.link as flink FROM {aggregator_item} i, {aggregator_feed} f WHERE i.iid = %d AND i.fid = f.fid', $iid))) {
@@ -222,50 +222,40 @@ function blog_form(&$node, &$error) {
/**
* Implementation of hook_content().
*/
-function blog_content($node, $main = 0) {
- return node_prepare($node, $main);
+function blog_content($node, $teaser = FALSE) {
+ return node_prepare($node, $teaser);
}
/**
* Implementation of hook_view().
*/
-function blog_view($node, $main = 0, $page = 0) {
+function blog_view($node, $teaser = FALSE, $page = FALSE) {
if ($page) {
// Breadcrumb navigation
- $breadcrumb[] = l(t('Home'), '');
- $breadcrumb[] = l(t('blogs'), 'blog');
- $breadcrumb[] = l(t("%name's blog", array('%name' => $node->name)), "blog/$node->uid");
- // set the breadcrumb
- drupal_set_breadcrumb($breadcrumb);
+ $breadcrumb[] = array('path' => 'blog', 'title' => t('blogs'));
+ $breadcrumb[] = array('path' => 'blog/'. $node->uid, 'title' => t("%name's blog", array('%name' => $node->name)));
+ $breadcrumb[] = array('path' => 'node/'. $node->nid);
+ menu_set_location($breadcrumb);
}
// prepare the node content
- $node = blog_content($node, $main);
+ $node = blog_content($node, $teaser);
// print the node
- return theme('node', $node, $main, $page);
+ return theme('node', $node, $teaser, $page);
}
/**
* Implementation of hook_link().
*/
function blog_link($type, $node = 0, $main) {
- global $user;
-
$links = array();
- if ($type == 'system') {
- menu('node/add/blog', t('blog entry'), user_access('maintain personal blog') ? MENU_FALLTHROUGH : MENU_DENIED, 0);
- menu('blog/'. $user->uid, t('my blog'), MENU_FALLTHROUGH, 1, MENU_SHOW, MENU_LOCKED);
- menu('blog', t('blogs'), user_access('access content') ? 'blog_page' : MENU_DENIED, 0, MENU_HIDE);
- menu('blog/feed', t('RSS feed'), user_access('access content') ? 'blog_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
- }
-
if ($type == 'page' && user_access('access content')) {
$links[] = l(t('blogs'), 'blog', array('title' => t('Read the latest blog entries.')));
}
if ($type == 'node' && $node->type == 'blog') {
if (blog_access('update', $node)) {
- $links[] = l(t('edit this blog entry'), "node/edit/$node->nid", array('title' => t('Edit this blog entry.')));
+ $links[] = l(t('edit this blog entry'), "node/$node->nid/edit", array('title' => t('Edit this blog entry.')));
}
elseif (arg(0) != 'blog' && arg(1) != $node->uid) {
$links[] = l(t("%username's blog", array('%username' => $node->name)), "blog/$node->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name))));
@@ -276,6 +266,29 @@ function blog_link($type, $node = 0, $main) {
}
/**
+ * Implementation of hook_menu().
+ */
+function blog_menu() {
+ global $user;
+
+ $items = array();
+ $items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
+ 'access' => user_access('maintain personal blog'));
+ $items[] = array('path' => 'blog', 'title' => t('blogs'),
+ 'callback' => 'blog_page',
+ 'access' => user_access('access content'),
+ 'type' => MENU_SUGGESTED_ITEM);
+ $items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
+ 'access' => user_access('maintain personal blog'),
+ 'type' => MENU_DYNAMIC_ITEM);
+ $items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
+ 'callback' => 'blog_feed',
+ 'access' => user_access('access content'),
+ 'type' => MENU_CALLBACK);
+ return $items;
+}
+
+/**
* Implementation of hook_block().
*
* Displays the most recent 10 blog titles.