From 3ea25a4f5efe9f5de5baf58a35d73850b5ad37db Mon Sep 17 00:00:00 2001 From: nickw Date: Fri, 2 Apr 2010 21:28:59 +0000 Subject: Determining which content header to use based on blog owner. Primary navigation tabs should not display on other users' blog lists. git-svn-id: http://code.elgg.org/elgg/trunk@5586 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/blog_lib.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'mod/blog/blog_lib.php') diff --git a/mod/blog/blog_lib.php b/mod/blog/blog_lib.php index d785b1a89..28c044c6b 100644 --- a/mod/blog/blog_lib.php +++ b/mod/blog/blog_lib.php @@ -19,8 +19,6 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { global $CONFIG; - $content = elgg_view('page_elements/content_header', array('context' => $context, 'type' => 'blog', 'all_link' => "{$CONFIG->site->url}pg/blog")); - if ($guid) { $blog = get_entity($guid); @@ -31,6 +29,12 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { $content = elgg_view_entity($blog, TRUE); } } else { + $content = elgg_view('page_elements/content_header', array( + 'context' => $context, + 'type' => 'blog', + 'all_link' => "{$CONFIG->site->url}pg/blog" + )); + $options = array( 'type' => 'object', 'subtype' => 'blog', @@ -38,13 +42,19 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { 'order_by_metadata' => array('name'=>'publish_date', 'direction'=>'DESC', 'as'=>'int') ); + $loggedin_userid = get_loggedin_userid(); if ($owner_guid) { $options['owner_guid'] = $owner_guid; + + if ($owner_guid != $loggedin_userid) { + // do not show content header when viewing other users' posts + $content = elgg_view('page_elements/content_header_member', array('type' => 'blog')); + } } // show all posts for admin or users looking at their own blogs // show only published posts for other users. - if (!(isadminloggedin() || (isloggedin() && $owner_guid == get_loggedin_userid()))) { + if (!(isadminloggedin() || (isloggedin() && $owner_guid == $loggedin_userid))) { $options['metadata_name_value_pairs'] = array( array('name' => 'status', 'value' => 'published'), array('name' => 'publish_date', 'operand' => '<', 'value' => time()) -- cgit v1.2.3