diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-26 13:06:38 -0600 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-26 13:06:38 -0600 |
commit | 51ac34e80c5a99008b1a945b2c00b6dbfdde1529 (patch) | |
tree | 42f0b79028414b3e73b2168a41e59b6d86153f34 /classes/User.php | |
parent | a3a5d23c54bfd2207728a957f370fc83ebfc4c65 (diff) |
first version of deleting users
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php index bea47a3b0..991e9c18f 100644 --- a/classes/User.php +++ b/classes/User.php @@ -685,4 +685,47 @@ class User extends Memcached_DataObject { return Design::staticGet('id', $this->design_id); } + + 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(); + + 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? + } } |