aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index ec3165a8d..c3ad2abfd 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -399,6 +399,28 @@
}
return false;
+ }
+
+ /**
+ * Disables all of a user's entities
+ *
+ * @param int $owner_guid The owner GUID
+ * @return true|false Depending on success
+ */
+ function disable_user_entities($owner_guid) {
+
+ global $CONFIG;
+ $owner_guid = (int) $owner_guid;
+ if ($entity = get_entity($owner_guid)) {
+ if (trigger_elgg_event('disable',$entity->type,$entity)) {
+ 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;
+
}
/**
@@ -417,7 +439,7 @@
// Check to see if we have access and it exists
if ($row)
{
- disable_entities($guid);
+ disable_user_entities($guid);
// Delete any existing stuff
return delete_data("DELETE from {$CONFIG->dbprefix}users_entity where guid=$guid");
}