mirror of
https://github.com/humhub/humhub.git
synced 2025-02-12 03:26:25 +01:00
Enh: Added virtual profile fields to display users e-mail address and username
This commit is contained in:
parent
b24cc27add
commit
8a36eab616
@ -18,3 +18,4 @@ HumHub Change Log
|
||||
- Enh: Added `humhub\modules\ui\form\widgets\JsInputWidget:emptyResult()` helper to manage render state of JsInputWidget
|
||||
- Enh: Added `humhub\modules\ui\form\widgets\JsInputWidget:field` in order to access ActiveField instances within JsInputWidget
|
||||
- Enh #4216: Added `humhub\modules\ui\filter\widgets\DropdownFilterInput` in order to support dropdown stream filters
|
||||
- Enh: Added virtual profile fields to display users e-mail address and username
|
||||
|
@ -85,6 +85,7 @@ class BaseType extends Model
|
||||
Checkbox::class => Yii::t('UserModule.profile', 'Checkbox'),
|
||||
CheckboxList::class => Yii::t('UserModule.profile', 'Checkbox List'),
|
||||
UserEmail::class => Yii::t('UserModule.profile', 'E-mail address of the user'),
|
||||
UserName::class => Yii::t('UserModule.profile', 'Username'),
|
||||
], $this->fieldTypes);
|
||||
|
||||
return $fieldTypes;
|
||||
|
33
protected/humhub/modules/user/models/fieldtype/UserName.php
Normal file
33
protected/humhub/modules/user/models/fieldtype/UserName.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\modules\user\models\fieldtype;
|
||||
|
||||
use humhub\libs\Html;
|
||||
|
||||
/**
|
||||
* UserName is a virtual profile field
|
||||
* that displays the current user name of the user.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class UserName extends BaseTypeVirtual
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getVirtualUserValue($user, $raw = true)
|
||||
{
|
||||
if (empty($user->username)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Html::encode($user->username);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user