forked from GNUsocial/gnu-social
We never accept a user without a Profile
This commit is contained in:
parent
f46d675a20
commit
1dc051a9eb
@ -120,16 +120,18 @@ class User extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $_profile = -1;
|
protected $_profile = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Profile
|
* @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);
|
$this->_profile = Profile::getKV('id', $this->id);
|
||||||
if (empty($this->_profile)) {
|
if (!($this->_profile instanceof Profile)) {
|
||||||
throw new UserNoProfileException($this);
|
throw new UserNoProfileException($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user