aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/entities.php3
-rw-r--r--engine/lib/river2.php25
2 files changed, 27 insertions, 1 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index d1402c397..dfb29fae1 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1295,6 +1295,9 @@
if ($ret===false)
return false;
+ if (!($entity instanceof ElggUser))
+ update_river_access_by_object($entity->guid,$entity->access_id);
+
return true;
}
diff --git a/engine/lib/river2.php b/engine/lib/river2.php
index 9d62d88f7..df985b45e 100644
--- a/engine/lib/river2.php
+++ b/engine/lib/river2.php
@@ -102,6 +102,29 @@
return delete_data("delete from {$CONFIG->dbprefix}river where object_guid = {$object_guid}");
}
+
+ /**
+ * Sets the access ID on river items for a particular object
+ *
+ * @param int $object_guid The GUID of the entity
+ * @param int $access_id The access ID
+ * @return true|false Depending on success
+ */
+ function update_river_access_by_object(
+ $object_guid, $access_id
+ ) {
+
+ // Sanitise
+ $object_guid = (int) $object_guid;
+ $access_id = (int) $access_id;
+
+ // Load config
+ global $CONFIG;
+
+ // Remove
+ return update_data("update {$CONFIG->dbprefix}river set access_id = {$access_id} where object_guid = {$object_guid}");
+
+ }
/**
* Retrieves items from the river. All parameters are optional.
@@ -129,7 +152,7 @@
$offset = 0,
$posted_min = 0,
$posted_max = 0
- ) {
+ ) {
// Get config
global $CONFIG;