Skip to content
This repository
Browse code

Added plugin hook triggers to reportedcontent plugin. Fixes #725

git-svn-id: https://code.elgg.org/elgg/trunk@2646 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information...
commit cb29f5f73e530b776002077f7c9afa45e094ff1c 1 parent 053480d
authored February 04, 2009
9  mod/reportedcontent/actions/add.php
@@ -26,8 +26,13 @@
26 26
 		    $entity->access_id = $access;
27 27
 		
28 28
     		if ($entity->save()) {
29  
-    			system_message(elgg_echo('reportedcontent:success'));
30  
-    			$entity->state = "active";
  29
+     			if (!trigger_plugin_hook('reportedcontent:add', $entity->type, array('entity'=>$entity), true)) {
  30
+     				$entity->delete();
  31
+     				register_error(elgg_echo('reportedcontent:failed'));
  32
+     			} else {
  33
+	    			system_message(elgg_echo('reportedcontent:success'));
  34
+	    			$entity->state = "active";
  35
+     			}
31 36
     			forward($address);
32 37
     		} else {
33 38
     			register_error(elgg_echo('reportedcontent:failed'));
4  mod/reportedcontent/actions/archive.php
@@ -21,6 +21,10 @@
21 21
 		if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) {
22 22
 	
23 23
 		// change the state
  24
+				if (!trigger_plugin_hook('reportedcontent:archive', $entity->type, array('entity'=>$entity), true)) {
  25
+ 					system_message(elgg_echo("reportedcontent:notarchived"));
  26
+ 					forward("pg/reportedcontent/");
  27
+		 		}
24 28
 		        $reported->state = "archived";
25 29
 				
26 30
 		// Success message
4  mod/reportedcontent/actions/delete.php
@@ -21,6 +21,10 @@
21 21
 		if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) {
22 22
 	
23 23
 		// Delete it!
  24
+				if (!trigger_plugin_hook('reportedcontent:delete', $entity->type, array('entity'=>$entity), true)) {
  25
+	 				register_error(elgg_echo("reportedcontent:notdeleted"));
  26
+	 				forward("pg/reportedcontent/");
  27
+	 			}
24 28
 				$rowsaffected = $reported->delete();
25 29
 				if ($rowsaffected > 0) {
26 30
 		// Success message
1  mod/reportedcontent/languages/en.php
@@ -40,6 +40,7 @@
40 40
 			'reportedcontent:moreinfo' => 'More info',
41 41
 	
42 42
 			'reportedcontent:failed' => 'Sorry, the attempt to report this content has failed.',
  43
+			'reportedcontent:notarchived' => 'We were not able to archive that report',
43 44
 	);
44 45
 					
45 46
 	add_translation("en",$english);

0 notes on commit cb29f5f

Please sign in to comment.
Something went wrong with that request. Please try again.