From: Mikael Nordfeldth Date: Mon, 14 Oct 2013 23:00:27 +0000 (+0200) Subject: We never accept a user without a Profile X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1dc051a9eb0d8ba9173aa5698dc849c9a19360f4;p=quix0rs-gnu-social.git We never accept a user without a Profile --- diff --git a/classes/User.php b/classes/User.php index e9f1d1b2cf..ca3281107e 100644 --- a/classes/User.php +++ b/classes/User.php @@ -120,16 +120,18 @@ class User extends Managed_DataObject ); } - protected $_profile = -1; + protected $_profile = null; /** * @return Profile + * + * @throws UserNoProfileException if user has no profile */ - function getProfile() + public function getProfile() { - if (is_int($this->_profile) && $this->_profile == -1) { // invalid but distinct from null + if (!($this->_profile instanceof Profile)) { $this->_profile = Profile::getKV('id', $this->id); - if (empty($this->_profile)) { + if (!($this->_profile instanceof Profile)) { throw new UserNoProfileException($this); } }