aboutsummaryrefslogtreecommitdiff
path: root/mod/messageboard/start.php
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
commitdccc333c765bb28da55b4a55d9c916acdb88413a (patch)
treebdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /mod/messageboard/start.php
parentec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff)
parent003cb81c7888f4d2fd763e5814027c6f8d71186f (diff)
downloadelgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz
elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod/messageboard/start.php')
-rw-r--r--mod/messageboard/start.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php
index efe453286..8a7f00958 100644
--- a/mod/messageboard/start.php
+++ b/mod/messageboard/start.php
@@ -26,6 +26,9 @@ function messageboard_init() {
$action_path = dirname(__FILE__) . '/actions';
elgg_register_action("messageboard/add", "$action_path/add.php");
elgg_register_action("messageboard/delete", "$action_path/delete.php");
+
+ // delete annotations for posts
+ elgg_register_plugin_hook_handler('register', 'menu:annotation', 'messageboard_annotation_menu_setup');
}
/**
@@ -127,4 +130,32 @@ function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC)
return $result;
}
+
+/**
+ * Add edit and delete links for forum replies
+ */
+function messageboard_annotation_menu_setup($hook, $type, $return, $params) {
+ $annotation = $params['annotation'];
+ if ($annotation->name != 'messageboard') {
+ return $return;
+ }
+
+ if ($annotation->canEdit()) {
+ $url = elgg_http_add_url_query_elements('action/messageboard/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);
+ }
+
+ return $return;
+}
+
elgg_register_event_handler('init', 'system', 'messageboard_init'); \ No newline at end of file