From: Evan Prodromou Date: Wed, 31 Mar 2010 19:02:19 +0000 (-0400) Subject: do complete unsubscribe process when deleting a user X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c1c7feedbd11cc291a0fb68ea8c4d322eb8bf538;p=quix0rs-gnu-social.git do complete unsubscribe process when deleting a user --- diff --git a/classes/Profile.php b/classes/Profile.php index eded1ff71f..5de35c191a 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -577,11 +577,41 @@ class Profile extends Memcached_DataObject { $sub = new Subscription(); $sub->subscriber = $this->id; - $sub->delete(); + + $sub->find(); + + while ($sub->fetch()) { + $other = Profile::staticGet('id', $sub->subscribed); + if (empty($other)) { + continue; + } + if ($other->id == $this->id) { + continue; + } + Subscription::cancel($this, $other); + } $subd = new Subscription(); $subd->subscribed = $this->id; - $subd->delete(); + $subd->find(); + + while ($subd->fetch()) { + $other = Profile::staticGet('id', $subd->subscriber); + if (empty($other)) { + continue; + } + if ($other->id == $this->id) { + continue; + } + Subscription::cancel($other, $this); + } + + $self = new Subscription(); + + $self->subscriber = $this->id; + $self->subscribed = $this->id; + + $self->delete(); } function _deleteMessages()