diff options
author | millette <millette@controlyourself.ca> | 2008-12-03 11:49:42 -0500 |
---|---|---|
committer | millette <millette@controlyourself.ca> | 2008-12-03 11:49:42 -0500 |
commit | 51dda412113d168476fabd15f346678bd2d301b6 (patch) | |
tree | 2ad42f170037575d3d637d5bae3d951ab85f47e6 /actions/profilesettings.php | |
parent | 9c3fdeeafb83899af5b5e1fc15147d0a5fa9043f (diff) |
delete user and all traces from the db.
darcs-hash:20081203164942-099f7-ea511948139c9c18b1c8b7de018aa4f0ee5ff624.gz
Diffstat (limited to 'actions/profilesettings.php')
-rw-r--r-- | actions/profilesettings.php | 101 |
1 files changed, 87 insertions, 14 deletions
diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 81e589c6e..f0083b219 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -509,22 +509,95 @@ class ProfilesettingsAction extends SettingsAction { } function delete_account() { - $user = common_current_user(); assert(!is_null($user)); # should already be checked - // delete avatar (profile_id and filename) - // delete fave (user_id) - // delete message (from_profile, to_profile) - // delete notice (profile_id) (also delete from notice_source and notice_tag) - // delete notice_inbox (user_id) - // delete subscription (subscriber, subscribed) - // delete user (id) - // delete user_openid (user_id) - // delete profile (id) - // delete tags tables (to verify) - // delete all the users notices - - $this->show_form(_('Your account has been deleted.'), true); + // deleted later through the profile + /* + $avatar = new Avatar; + $avatar->profile_id = $user->id; + $n_avatars_deleted = $avatar->delete(); + */ + + $fave = new Fave; + $fave->user_id = $user->id; + $n_faves_deleted = $fave->delete(); + + $confirmation = new Confirm_address; + $confirmation->user_id = $user->id; + $n_confirmations_deleted = $confirmation->delete(); + + // TODO foreign stuff... + + $invitation = new Invitation; + $invitation->user_id = $user->id; + $n_invitations_deleted = $invitation->delete(); + + $message_from = new Message; + $message_from->from_profile = $user->id; + $n_messages_from_deleted = $message_from->delete(); + + $message_to = new Message; + $message_to->to_profile = $user->id; + $n_messages_to_deleted = $message_to->delete(); + + $notice = new Notice; + $notice->profile_id = $user->id; + $n_notices_deleted = $notice->delete(); + + $notice_inbox = new Notice_inbox; + $notice_inbox->user_id = $user->id; + $n_notices_inbox_deleted = $notice_inbox->delete(); + + $profile_tagger = new Profile_tag; + $profile_tagger->tagger = $user->id; + $n_profiles_tagger_deleted = $profile_tagger->delete(); + + $profile_tagged = new Profile_tag; + $profile_tagged->tagged = $user->id; + $n_profiles_tagged_deleted = $profile_tagged->delete(); + + $remember_me = new Remember_me; + $remember_me->user_id = $user->id; + $n_remember_mes_deleted = $remember_me->delete(); + + $reply_from = new Reply; + $reply_from->profile_id = $user->id; + $n_replies_from_deleted = $reply_from->delete(); + + // not sure if this should be deleted... + //TODO: test + if (1) { + $reply_to = new Reply; + $reply_to->replied_id = $user->id; + $reply_to->find(); + while ($reply_to->fetch()) { + $str = print_r($reply_to, true); + } +// $n_replies_to_deleted = $reply_to->delete(); + } + + $subscriber = new Subscription; + $subscriber->subscriber = $user->id; + $n_subscribers_deleted = $subscriber->delete(); + + $subscribed = new Subscription; + $subscribed->subscribed = $user->id; + $n_subscribeds_deleted = $subscribed->delete(); + + $user_openid = new User_openid; + $user_openid->user_id = $user->id; + $n_user_openids_deleted = $user_openid->delete(); + + // last steps + if (0) { + $profile = new Profile; + $profile->id = $user->id; + $profile->delete_avatars(); + $n_profiles_deleted = $profile->delete(); + $n_users_deleted = $user->delete(); + } + + $this->show_form(_("Your account has been deleted. ($str)"), true); } } |