X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=classes%2FProfile.php;h=49addfe47fe887d72d84f73c57fde62c25ed1098;hb=129bd1bf037a7c1c9b954b522f8f45ab164e7924;hp=5359ffb58b31444a19b3a265278489c9e0fa5f73;hpb=9f82da07f105792403807ab444de873bfcd7a45f;p=quix0rs-gnu-social.git diff --git a/classes/Profile.php b/classes/Profile.php index 5359ffb58b..49addfe47f 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -144,7 +144,7 @@ class Profile extends Managed_DataObject public function hasPassword() { try { - return !empty($this->getUser()->hasPassword()); + return $this->getUser()->hasPassword(); } catch (NoSuchUserException $e) { return false; } @@ -877,6 +877,11 @@ class Profile extends Managed_DataObject 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(); @@ -1588,8 +1593,20 @@ class Profile extends Managed_DataObject return $this; } - public function sameAs(Profile $other) + /** + * Test whether the given profile is the same as the current class, + * for testing identities. + * + * @param Profile $other The other profile, usually from Action's $this->scoped + * + * @return boolean + */ + public function sameAs(Profile $other=null) { + if (is_null($other)) { + // In case $this->scoped is null or something, i.e. not a current/legitimate profile. + return false; + } return $this->getID() === $other->getID(); }