aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-12-23 23:01:08 -0500
committerCash Costello <cash.costello@gmail.com>2011-12-23 23:01:08 -0500
commitb18e603a928801d5a3d9f2847e03a96307937e19 (patch)
tree26965bb6d414ff6eb2743a8168783798209d2394 /mod/blog/views
parent995472e31c181c729944d2bd9f2c4af5453705e3 (diff)
downloadelgg-b18e603a928801d5a3d9f2847e03a96307937e19.tar.gz
elgg-b18e603a928801d5a3d9f2847e03a96307937e19.tar.bz2
Fixes #3751 adds a group blog archive page
Diffstat (limited to 'mod/blog/views')
-rw-r--r--mod/blog/views/default/blog/sidebar.php2
-rw-r--r--mod/blog/views/default/blog/sidebar/archives.php10
2 files changed, 9 insertions, 3 deletions
diff --git a/mod/blog/views/default/blog/sidebar.php b/mod/blog/views/default/blog/sidebar.php
index 97a23c17e..0ae2b431c 100644
--- a/mod/blog/views/default/blog/sidebar.php
+++ b/mod/blog/views/default/blog/sidebar.php
@@ -18,7 +18,7 @@ if ($vars['page'] == 'all') {
}
// only users can have archives at present
-if (elgg_instanceof(elgg_get_page_owner_entity(), 'user')) {
+if ($vars['page'] == 'owner' || $vars['page'] == 'group') {
echo elgg_view('blog/sidebar/archives', $vars);
}
diff --git a/mod/blog/views/default/blog/sidebar/archives.php b/mod/blog/views/default/blog/sidebar/archives.php
index 3aa3db44f..3d8f28ca4 100644
--- a/mod/blog/views/default/blog/sidebar/archives.php
+++ b/mod/blog/views/default/blog/sidebar/archives.php
@@ -6,6 +6,12 @@
$loggedin_user = elgg_get_logged_in_user_entity();
$page_owner = elgg_get_page_owner_entity();
+if (elgg_instanceof($page_owner, 'user')) {
+ $url_segment = 'blog/archive/' . $page_owner->username;
+} else {
+ $url_segment = 'blog/group/' . $page_owner->getGUID() . '/archive';
+}
+
// This is a limitation of the URL schema.
if ($page_owner && $vars['page'] != 'friends') {
$dates = get_entity_dates('object', 'blog', $page_owner->getGUID());
@@ -13,11 +19,11 @@ if ($page_owner && $vars['page'] != 'friends') {
if ($dates) {
$title = elgg_echo('blog:archives');
$content = '<ul class="blog-archives">';
- foreach($dates as $date) {
+ foreach ($dates as $date) {
$timestamplow = mktime(0, 0, 0, substr($date,4,2) , 1, substr($date, 0, 4));
$timestamphigh = mktime(0, 0, 0, ((int) substr($date, 4, 2)) + 1, 1, substr($date, 0, 4));
- $link = elgg_get_site_url() . 'blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh;
+ $link = elgg_get_site_url() . $url_segment . '/' . $timestamplow . '/' . $timestamphigh;
$month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4)));
$content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>";
}