diff options
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/lib/discussion.php | 5 | ||||
-rw-r--r-- | mod/groups/start.php | 17 | ||||
-rw-r--r-- | mod/groups/topicposts.php | 2 |
3 files changed, 20 insertions, 4 deletions
diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 55642644d..02ab27fdc 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -149,8 +149,9 @@ function discussion_handle_view_page($guid) { $topic = get_entity($guid); if (!$topic) { - register_error(elgg_echo('discussion:topic:notfound')); - forward(); + register_error(elgg_echo('noaccess')); + $_SESSION['last_forward_from'] = current_page_url(); + forward(''); } $group = $topic->getContainerEntity(); diff --git a/mod/groups/start.php b/mod/groups/start.php index aeab0649a..c8198371b 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -714,6 +714,7 @@ function discussion_init() { elgg_register_library('elgg:discussion', elgg_get_plugins_path() . 'groups/lib/discussion.php'); elgg_register_page_handler('discussion', 'discussion_page_handler'); + elgg_register_page_handler('forum', 'discussion_forum_page_handler'); elgg_register_entity_url_handler('object', 'groupforumtopic', 'discussion_override_topic_url'); @@ -745,6 +746,20 @@ function discussion_init() { } /** + * Exists for backwards compatibility for Elgg 1.7 + */ +function discussion_forum_page_handler($page) { + switch ($page[0]) { + case 'topic': + header('Status: 301 Moved Permanently'); + forward("/discussion/view/{$page[1]}/{$page[2]}"); + break; + default: + return false; + } +} + +/** * Discussion page handler * * URLs take the form of @@ -792,7 +807,7 @@ function discussion_page_handler($page) { * @return string */ function discussion_override_topic_url($entity) { - return 'discussion/view/' . $entity->guid; + return 'discussion/view/' . $entity->guid . '/' . elgg_get_friendly_title($entity->title); } /** diff --git a/mod/groups/topicposts.php b/mod/groups/topicposts.php index f9dd3344b..81c860631 100644 --- a/mod/groups/topicposts.php +++ b/mod/groups/topicposts.php @@ -10,7 +10,7 @@ // Load Elgg engine require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); -elgg_load_library('elgg:topic'); +elgg_load_library('elgg:discussion'); $guid = get_input('topic'); |