From 062a8abdeae40ab03004f7c11dc21b7a13b57ca1 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 24 Nov 2004 20:06:10 +0000 Subject: - Patch #10990 by TDobes: adds a "create new blog entry" link at the top of each user's own blog page, similar to the "post new forum topic" link displayed at the top of forum pages. This adds consistency as well as convenience for users. --- modules/blog/blog.module | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'modules/blog/blog.module') diff --git a/modules/blog/blog.module b/modules/blog/blog.module index eb95fbf5e..54adb2883 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -136,11 +136,26 @@ function blog_page($uid = 0) { * Displays a Drupal page containing recent blog entries of a given user. */ function blog_page_user($uid) { + global $user; + $account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1)); if ($account->uid) { $title = t("%name's blog", array('%name' => $account->name)); - $output = ''; + + if (($account->uid == $user->uid) && user_access('edit own blog')) { + $output = '
  • '. l(t('Post new blog entry.'), "node/add/blog") .'
  • '; + } + else if ($account->uid == $user->uid) { + $output = '
  • '. t('You are not allowed to post a new blog entry.') .'
  • '; + } + + if ($output) { + $output = ''; + } + else { + $output = ''; + } $result = pager_query('SELECT DISTINCT(n.nid), n.sticky, n.created FROM {node} n '. node_access_join_sql() ." WHERE type = 'blog' AND n.uid = %d AND n.status = 1 AND ". node_access_where_sql() .' ORDER BY n.sticky DESC, n.created DESC', variable_get('default_nodes_main', 10), 0, NULL, $account->uid); while ($node = db_fetch_object($result)) { -- cgit v1.2.3