mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
#4283 Added UserMemberSince.php class for virtual field. Init UserMemberSince in BaseType.php class
This commit is contained in:
parent
bf50021e8a
commit
29d4d1f24e
@ -86,6 +86,7 @@ class BaseType extends Model
|
||||
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'),
|
||||
UserMemberSince::class => Yii::t('UserModule.profile', 'User member since'),
|
||||
], $this->fieldTypes);
|
||||
|
||||
return $fieldTypes;
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* UserEmail is a virtual profile field
|
||||
* that displays the user member since information
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class UserMemberSince extends BaseTypeVirtual
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getVirtualUserValue($user, $raw = true)
|
||||
{
|
||||
if (empty($user->created_at)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($raw) {
|
||||
return Html::encode($user->created_at);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user