]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
'creating', 'river' is the plugin hook for preventing or catching a river addition...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 19 May 2011 23:52:50 +0000 (23:52 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 19 May 2011 23:52:50 +0000 (23:52 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@9103 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/river.php

index 80f285e502e6e20e354f2acc369391542aff8dfe..49b070082539b4e340334d3b7a681e2206277bfd 100644 (file)
@@ -23,7 +23,9 @@
 function add_to_river($view, $action_type, $subject_guid, $object_guid, $access_id = "",
 $posted = 0, $annotation_id = 0) {
 
-       // use default viewtype for when called from REST api
+       global $CONFIG;
+
+       // use default viewtype for when called from web services api
        if (!elgg_view_exists($view, 'default')) {
                return false;
        }
@@ -60,7 +62,7 @@ $posted = 0, $annotation_id = 0) {
        );
 
        // return false to stop insert
-       $params = elgg_trigger_plugin_hook('add', 'river', null, $params);
+       $params = elgg_trigger_plugin_hook('creating', 'river', null, $params);
        if ($params == false) {
                // inserting did not fail - it was just prevented
                return true;
@@ -68,9 +70,6 @@ $posted = 0, $annotation_id = 0) {
 
        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', " .
@@ -83,7 +82,8 @@ $posted = 0, $annotation_id = 0) {
                " annotation_id = $annotation_id, " .
                " posted = $posted");
 
-       //update the entities which had the action carried out on it
+       // update the entities which had the action carried out on it
+       // @todo shouldn't this be down elsewhere? Like when an annotation is saved?
        if ($insert_data) {
                update_entity_last_action($object_guid, $posted);
                return $insert_data;