mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 22:27:34 +02:00
Introducing getDisplayName(), getLoginName(), getRealName() user model getters. Preparing for user table DB field name changes in the future.
This commit is contained in:
@@ -155,14 +155,43 @@ class e_user_model extends e_admin_model
|
||||
return (integer) parent::getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Try display name, fall back to login name when empty (shouldn't happen)
|
||||
*/
|
||||
final public function getName($anon = false)
|
||||
{
|
||||
if($this->isUser())
|
||||
{
|
||||
return ($this->get('user_name') ? $this->get('user_name') : $this->get('user_login'));
|
||||
return ($this->get('user_name') ? $this->get('user_name') : $this->get('user_loginname'));
|
||||
}
|
||||
return $anon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display name getter. Use it as DB field name will be changed soon.
|
||||
*/
|
||||
final public function getDisplayName()
|
||||
{
|
||||
return $this->get('user_name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Login name getter. Use it as DB field name will be changed soon.
|
||||
*/
|
||||
final public function getLoginName()
|
||||
{
|
||||
return $this->get('user_loginname');
|
||||
}
|
||||
|
||||
/**
|
||||
* Real name getter. Use it as DB field name will be changed soon.
|
||||
* @param bool $strict if false, fall back to Display name when empty
|
||||
*/
|
||||
final public function getRealName($strict = false)
|
||||
{
|
||||
if($strict) return $this->get('user_login');
|
||||
return ($this->get('user_login') ? $this->get('user_login') : $this->get('user_name'));
|
||||
}
|
||||
|
||||
final public function getAdminId()
|
||||
{
|
||||
|
Reference in New Issue
Block a user