X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FUser.php;h=1928a3c62fb1735b1c9ecab9a01595f6064ca191;hb=71c828de89d4092579470c9f2ba821ae803cb557;hp=8ad2ec63d5c81d12cbf6c3b35c7eb41b8cac5e60;hpb=79ec565104b8d546e4f2ffca2f351fba1be753d2;p=quix0rs-gnu-social.git diff --git a/classes/User.php b/classes/User.php index 8ad2ec63d5..1928a3c62f 100644 --- a/classes/User.php +++ b/classes/User.php @@ -525,8 +525,8 @@ class User extends Memcached_DataObject common_log(LOG_WARNING, sprintf( "Profile ID %d (%s) tried to block his or herself.", - $profile->id, - $profile->nickname + $this->id, + $this->nickname ) ); return false; @@ -548,12 +548,9 @@ class User extends Memcached_DataObject return false; } - // Cancel their subscription, if it exists - - $otherUser = User::staticGet('id', $other->id); - - if (!empty($otherUser)) { - subs_unsubscribe_to($otherUser, $this->getProfile()); + $self = $this->getProfile(); + if (Subscription::exists($other, $self)) { + Subscription::cancel($other, $self); } $block->query('COMMIT'); @@ -670,8 +667,12 @@ class User extends Memcached_DataObject function delete() { - $profile = $this->getProfile(); - $profile->delete(); + try { + $profile = $this->getProfile(); + $profile->delete(); + } catch (UserNoProfileException $unp) { + common_log(LOG_INFO, "User {$this->nickname} has no profile; continuing deletion."); + } $related = array('Fave', 'Confirm_address', @@ -679,6 +680,7 @@ class User extends Memcached_DataObject 'Foreign_link', 'Invitation', ); + Event::handle('UserDeleteRelated', array($this, &$related)); foreach ($related as $cls) {