diff options
-rw-r--r-- | mod/blog/lib/blog.php | 22 | ||||
-rw-r--r-- | mod/blog/start.php | 3 |
2 files changed, 20 insertions, 5 deletions
diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 4622a9e7e..4dcc7d56e 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -396,6 +396,14 @@ function blog_prepare_form_vars($post = NULL, $revision = NULL) { /** * Forward to the new style of URLs + * + * Pre-1.7.5 + * Group blogs page: /blog/group:<container_guid>/ + * Group blog view: /blog/group:<container_guid>/read/<guid>/<title> + * 1.7.5-1.8 + * Group blogs page: /blog/owner/group:<container_guid>/ + * Group blog view: /blog/read/<guid> + * * * @param string $page */ @@ -403,17 +411,25 @@ function blog_url_forwarder($page) { global $CONFIG; // group usernames - if (substr_count($page[0], 'group:')) { - preg_match('/group\:([0-9]+)/i', $page[0], $matches); + if (substr_count(implode('/', $page), 'group:')) { + preg_match('/group\:([0-9]+)/i', implode('/', $page), $matches); $guid = $matches[1]; $entity = get_entity($guid); if ($entity) { - $url = "{$CONFIG->wwwroot}blog/group/$guid/all"; + if (isset($page[2])) { + $url = "{$CONFIG->wwwroot}blog/view/$page[2]/?view=" . elgg_get_viewtype(); + } else { + $url = "{$CONFIG->wwwroot}blog/group/$guid/all?view=" . elgg_get_viewtype(); + } register_error(elgg_echo("changebookmark")); forward($url); } } + if (!isset($page[0])) { + return; + } + // user usernames $user = get_user_by_username($page[0]); if (!$user) { diff --git a/mod/blog/start.php b/mod/blog/start.php index 9faf1794e..8cbaf5cca 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -99,8 +99,7 @@ function blog_page_handler($page) { elgg_load_library('elgg:blog'); - // @todo remove the forwarder in 1.9 - // forward to correct URL for blog pages pre-1.7.5 + // forward to correct URL for blog pages pre-1.8 blog_url_forwarder($page); // push all blogs breadcrumb |