]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User.php
Mobile Profile plugin will use the identica theme for now
[quix0rs-gnu-social.git] / classes / User.php
index 3f7ed09bb7ae508c324ebec07f436060d6f40ca1..48df0cdd773f46b9b4b98379ab5ce7589105d073 100644 (file)
@@ -740,4 +740,48 @@ class User extends Memcached_DataObject
         }
         return $result;
     }
+
+    function delete()
+    {
+        $profile = $this->getProfile();
+        $profile->delete();
+
+        $related = array('Fave',
+                         'User_openid',
+                         'Confirm_address',
+                         'Remember_me',
+                         'Foreign_link',
+                         'Invitation',
+                         );
+
+        if (common_config('inboxes', 'enabled')) {
+            $related[] = 'Notice_inbox';
+        }
+
+        foreach ($related as $cls) {
+            $inst = new $cls();
+            $inst->user_id = $this->id;
+            $inst->delete();
+        }
+
+        $this->_deleteTags();
+        $this->_deleteBlocks();
+
+        parent::delete();
+    }
+
+    function _deleteTags()
+    {
+        $tag = new Profile_tag();
+        $tag->tagger = $this->id;
+        $tag->delete();
+    }
+
+    function _deleteBlocks()
+    {
+        $block = new Profile_block();
+        $block->blocker = $this->id;
+        $block->delete();
+        // XXX delete group block? Reset blocker?
+    }
 }