From 222de7d107e5f90610c1d7f387cacec56ddbed44 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 13 Jan 2011 02:57:43 +0000 Subject: Fixes #2402 adds 'add' 'river' plugin hook git-svn-id: http://code.elgg.org/elgg/trunk@7877 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/river.php | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'engine/lib/river.php') 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) { -- cgit v1.2.3