aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/river.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-13 02:57:43 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-13 02:57:43 +0000
commit222de7d107e5f90610c1d7f387cacec56ddbed44 (patch)
tree06ccc79f71cf0ef8c874eb095da848f1a1cc6d08 /engine/lib/river.php
parent206673eb95edce046d6012c2343cdee63b5f4884 (diff)
downloadelgg-222de7d107e5f90610c1d7f387cacec56ddbed44.tar.gz
elgg-222de7d107e5f90610c1d7f387cacec56ddbed44.tar.bz2
Fixes #2402 adds 'add' 'river' plugin hook
git-svn-id: http://code.elgg.org/elgg/trunk@7877 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/river.php')
-rw-r--r--engine/lib/river.php39
1 files changed, 30 insertions, 9 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php
index f098c0c9e..38197e387 100644
--- a/engine/lib/river.php
+++ b/engine/lib/river.php
@@ -47,20 +47,41 @@ $posted = 0, $annotation_id = 0) {
$subtype = $object->getSubtype();
$action_type = sanitise_string($action_type);
+ $params = array(
+ 'type' => $type,
+ 'subtype' => $subtype,
+ 'action_type' => $action_type,
+ 'access_id' => $access_id,
+ 'view' => $view,
+ 'subject_guid' => $subject_guid,
+ 'object_guid' => $object_guid,
+ 'annotation_id' => $annotation_id,
+ 'posted' => $posted,
+ );
+
+ // return false to stop insert
+ $params = elgg_trigger_plugin_hook('add', 'river', null, $params);
+ if ($params == false) {
+ // inserting did not fail - it was just prevented
+ return true;
+ }
+
+ extract($params);
+
// Load config
global $CONFIG;
// Attempt to save river item; return success status
$insert_data = insert_data("insert into {$CONFIG->dbprefix}river " .
- " set type = '{$type}', " .
- " subtype = '{$subtype}', " .
- " action_type = '{$action_type}', " .
- " access_id = {$access_id}, " .
- " view = '{$view}', " .
- " subject_guid = {$subject_guid}, " .
- " object_guid = {$object_guid}, " .
- " annotation_id = {$annotation_id}, " .
- " posted = {$posted} ");
+ " set type = '$type', " .
+ " subtype = '$subtype', " .
+ " action_type = '$action_type', " .
+ " access_id = $access_id, " .
+ " view = '$view', " .
+ " subject_guid = $subject_guid, " .
+ " object_guid = $object_guid, " .
+ " annotation_id = $annotation_id, " .
+ " posted = $posted");
//update the entities which had the action carried out on it
if ($insert_data) {