diff options
-rw-r--r-- | engine/lib/entities.php | 20 | ||||
-rw-r--r-- | engine/lib/users.php | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index a2026d982..0f9f24c81 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1495,6 +1495,26 @@ } } return false; + }
+
+ /**
+ * Disables all of a user's entities
+ *
+ * @param int $owner_guid The owner GUID
+ * @return true|false Depending on success
+ */
+ function disable_entities($owner_guid) {
+
+ global $CONFIG;
+ $owner_guid = (int) $owner_guid;
+ if ($entity = get_entity($owner_guid)) {
+ if ($entity->canEdit()) {
+ $res = update_data("UPDATE {$CONFIG->dbprefix}entities set enabled='no' where owner_guid={$owner_guid} or container_guid = {$owner_guid}");
+ return $res;
+ }
+ }
+ return false;
+
} /** diff --git a/engine/lib/users.php b/engine/lib/users.php index cb233466d..edc444585 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -404,6 +404,7 @@ // Check to see if we have access and it exists
if ($row)
{
+ disable_entities($guid);
// Delete any existing stuff
return delete_data("DELETE from {$CONFIG->dbprefix}users_entity where guid=$guid");
}
|