aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-04 15:29:16 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-04 15:29:16 +0000
commitcb29f5f73e530b776002077f7c9afa45e094ff1c (patch)
treef458143d78c2f1942566b07239a65e47fd142925 /mod
parent053480d718c7613d4b778350b757b9e35f9d8f54 (diff)
downloadelgg-cb29f5f73e530b776002077f7c9afa45e094ff1c.tar.gz
elgg-cb29f5f73e530b776002077f7c9afa45e094ff1c.tar.bz2
Added plugin hook triggers to reportedcontent plugin. Fixes #725
git-svn-id: https://code.elgg.org/elgg/trunk@2646 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/reportedcontent/actions/add.php9
-rw-r--r--mod/reportedcontent/actions/archive.php4
-rw-r--r--mod/reportedcontent/actions/delete.php4
-rw-r--r--mod/reportedcontent/languages/en.php1
4 files changed, 16 insertions, 2 deletions
diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php
index 3f818ca3c..c43e14baa 100644
--- a/mod/reportedcontent/actions/add.php
+++ b/mod/reportedcontent/actions/add.php
@@ -26,8 +26,13 @@
$entity->access_id = $access;
if ($entity->save()) {
- system_message(elgg_echo('reportedcontent:success'));
- $entity->state = "active";
+ if (!trigger_plugin_hook('reportedcontent:add', $entity->type, array('entity'=>$entity), true)) {
+ $entity->delete();
+ register_error(elgg_echo('reportedcontent:failed'));
+ } else {
+ system_message(elgg_echo('reportedcontent:success'));
+ $entity->state = "active";
+ }
forward($address);
} else {
register_error(elgg_echo('reportedcontent:failed'));
diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php
index 144b6b864..6f4a41226 100644
--- a/mod/reportedcontent/actions/archive.php
+++ b/mod/reportedcontent/actions/archive.php
@@ -21,6 +21,10 @@
if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) {
// change the state
+ if (!trigger_plugin_hook('reportedcontent:archive', $entity->type, array('entity'=>$entity), true)) {
+ system_message(elgg_echo("reportedcontent:notarchived"));
+ forward("pg/reportedcontent/");
+ }
$reported->state = "archived";
// Success message
diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php
index 87ac0e40f..a4090fb19 100644
--- a/mod/reportedcontent/actions/delete.php
+++ b/mod/reportedcontent/actions/delete.php
@@ -21,6 +21,10 @@
if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) {
// Delete it!
+ if (!trigger_plugin_hook('reportedcontent:delete', $entity->type, array('entity'=>$entity), true)) {
+ register_error(elgg_echo("reportedcontent:notdeleted"));
+ forward("pg/reportedcontent/");
+ }
$rowsaffected = $reported->delete();
if ($rowsaffected > 0) {
// Success message
diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php
index 7d86386ef..d4941e030 100644
--- a/mod/reportedcontent/languages/en.php
+++ b/mod/reportedcontent/languages/en.php
@@ -40,6 +40,7 @@
'reportedcontent:moreinfo' => 'More info',
'reportedcontent:failed' => 'Sorry, the attempt to report this content has failed.',
+ 'reportedcontent:notarchived' => 'We were not able to archive that report',
);
add_translation("en",$english);