aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/start.php
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-24 20:38:12 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-24 20:38:12 -0700
commit6f4ca315db3a8c162fe032e79a9b27f16732bf2d (patch)
treedeadd908bf531250913e174b6926f992189eacb7 /mod/groups/start.php
parent019729173bcd7c28760a5e97bc9a2ec79ada3278 (diff)
downloadelgg-6f4ca315db3a8c162fe032e79a9b27f16732bf2d.tar.gz
elgg-6f4ca315db3a8c162fe032e79a9b27f16732bf2d.tar.bz2
Fixes #3612, #3750. Added edit replies back to group plugin with the annotation menu.
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r--mod/groups/start.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 83353bae5..9e4694457 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -65,6 +65,9 @@ function groups_init() {
// group user hover menu
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'groups_user_entity_menu_setup');
+ // delete and edit annotations for topic replies
+ elgg_register_plugin_hook_handler('register', 'menu:annotation', 'groups_annotation_menu_setup');
+
//extend some views
elgg_extend_view('css/elgg', 'groups/css');
elgg_extend_view('js/elgg', 'groups/js');
@@ -409,6 +412,51 @@ function groups_user_entity_menu_setup($hook, $type, $return, $params) {
}
/**
+ * Add edit and delete links for forum replies
+ */
+function groups_annotation_menu_setup($hook, $type, $return, $params) {
+ if (elgg_in_context('widgets')) {
+ return $return;
+ }
+
+ $annotation = $params['annotation'];
+
+ if ($annotation->name != 'group_topic_post') {
+ return $return;
+ }
+
+ if ($annotation->canEdit()) {
+ $url = elgg_http_add_url_query_elements('action/discussion/reply/delete', array(
+ 'annotation_id' => $annotation->id,
+ ));
+
+ $options = array(
+ 'name' => 'delete',
+ 'href' => $url,
+ 'text' => "<span class=\"elgg-icon elgg-icon-delete\"></span>",
+ 'confirm' => elgg_echo('deleteconfirm'),
+ 'text_encode' => false
+ );
+ $return[] = ElggMenuItem::factory($options);
+
+ $url = elgg_http_add_url_query_elements('discussion', array(
+ 'annotation_id' => $annotation->id,
+ ));
+
+ $options = array(
+ 'name' => 'edit',
+ 'href' => "#edit-annotation-$annotation->id",
+ 'text' => elgg_echo('edit'),
+ 'text_encode' => false,
+ 'rel' => 'toggle',
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+
+ return $return;
+}
+
+/**
* Groups created so create an access list for it
*/
function groups_create_event_listener($event, $object_type, $object) {