profile deleting user deleting profile deleting user...
function delete($useWhere=false)
{
+ // just in case it hadn't been done before... (usually set before adding deluser to queue handling!)
+ if (!$this->hasRole(Profile_role::DELETED)) {
+ $this->grantRole(Profile_role::DELETED);
+ }
+
$this->_deleteNotices();
$this->_deleteSubscriptions();
$this->_deleteTags();
}
try {
- $profile = $this->getProfile();
- $profile->delete();
+ if (!$this->hasRole(Profile_role::DELETED)) {
+ $profile = $this->getProfile();
+ $profile->delete();
+ }
} catch (UserNoProfileException $unp) {
common_log(LOG_INFO, "User {$this->nickname} has no profile; continuing deletion.");
}
$qm = QueueManager::get();
$qm->enqueue($user, 'deluser');
} else {
- // Out of notices? Let's finish deleting this guy!
- $user->delete();
+ // Out of notices? Let's finish deleting this profile!
+ try {
+ $user->getProfile()->delete();
+ } catch (UserNoProfileException $e) {
+ // in case a profile didn't exist for some reason, just delete the User directly
+ $user->delete();
+ }
common_log(LOG_INFO, "User $user->id $user->nickname deleted.");
return true;
}