mirror of
https://github.com/humhub/humhub.git
synced 2025-02-24 19:23:21 +01:00
Merge remote-tracking branch 'origin/feature/sub-title' into develop
This commit is contained in:
commit
ac92f60a2b
@ -77,6 +77,11 @@ class Module extends \humhub\components\Module
|
||||
*/
|
||||
public $displayNameCallback = null;
|
||||
|
||||
/**
|
||||
* @var callable a callback that returns the user displayName sub text
|
||||
*/
|
||||
public $displayNameSubCallback = null;
|
||||
|
||||
/**
|
||||
* @var boolean defines if the user following is disabled or not.
|
||||
* @since 1.2
|
||||
|
@ -25,6 +25,7 @@ use humhub\modules\user\behaviors\Followable;
|
||||
use humhub\modules\user\behaviors\ProfileController;
|
||||
use humhub\modules\user\components\ActiveQueryUser;
|
||||
use humhub\modules\user\events\UserEvent;
|
||||
use humhub\modules\user\Module;
|
||||
use humhub\modules\user\widgets\UserWall;
|
||||
use Yii;
|
||||
use yii\base\Exception;
|
||||
@ -55,6 +56,7 @@ use yii\web\IdentityInterface;
|
||||
* @property Profile $profile
|
||||
*
|
||||
* @property string $displayName
|
||||
* @property string $displayNameSub
|
||||
*/
|
||||
class User extends ContentContainerActiveRecord implements IdentityInterface, Searchable
|
||||
{
|
||||
@ -548,8 +550,11 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
if (Yii::$app->getModule('user')->displayNameCallback !== null) {
|
||||
return call_user_func(Yii::$app->getModule('user')->displayNameCallback, $this);
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
|
||||
if ($module->displayNameCallback !== null) {
|
||||
return call_user_func($module->displayNameCallback, $this);
|
||||
}
|
||||
|
||||
$name = '';
|
||||
@ -568,6 +573,29 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the users display name sub text.
|
||||
* Per default as sub text the 'title' profile attribute is used
|
||||
*
|
||||
* @return string the display name sub text
|
||||
*/
|
||||
public function getDisplayNameSub()
|
||||
{
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
|
||||
if ($module->displayNameSubCallback !== null) {
|
||||
return call_user_func($module->displayNameSubCallback, $this);
|
||||
}
|
||||
|
||||
if ($this->profile !== null && $this->profile->hasAttribute('title')) {
|
||||
return $this->profile->title;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if this user is the current logged in user.
|
||||
* @inheritdoc
|
||||
|
@ -28,7 +28,7 @@ $userModel = Yii::$app->user->getIdentity();
|
||||
|
||||
<?php if ($this->context->showUserName): ?>
|
||||
<div class="user-title pull-left hidden-xs">
|
||||
<strong><?= Html::encode($userModel->displayName); ?></strong><br/><span class="truncate"><?= Html::encode($userModel->profile->title); ?></span>
|
||||
<strong><?= Html::encode($userModel->displayName); ?></strong><br/><span class="truncate"><?= Html::encode($userModel->displayNameSub); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -57,8 +57,7 @@ if ($allowModifyProfileBanner || $allowModifyProfileImage) {
|
||||
<!-- show user name and title -->
|
||||
<div class="img-profile-data">
|
||||
<h1><?= Html::encode($user->displayName); ?></h1>
|
||||
|
||||
<h2><?= Html::encode($user->profile->title); ?></h2>
|
||||
<h2><?= Html::encode($user->displayNameSub); ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- check if the current user is the profile owner and can change the images -->
|
||||
|
@ -30,7 +30,7 @@ use yii\helpers\Html;
|
||||
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading"><?= Html::encode($user->displayName); ?></h4>
|
||||
<h5><?= Html::encode($user->profile->title); ?></h5>
|
||||
<h5><?= Html::encode($user->displayNameSub); ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
@ -11,7 +11,7 @@ use humhub\modules\directory\widgets\UserTagList;
|
||||
<?= Image::widget(['user' => $user, 'width' => 40, 'htmlOptions' => ['class' => 'pull-left']]); ?>
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading"><?= Html::containerLink($user); ?></h4>
|
||||
<h5><?php echo Html::encode($user->profile->title); ?></h5>
|
||||
<h5><?= Html::encode($user->displayNameSub); ?></h5>
|
||||
<?= UserTagList::widget(['user' => $user]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -33,14 +33,14 @@ class MailContentContainerInfoBox extends \yii\base\Widget
|
||||
'container' => $this->container,
|
||||
'url' => $this->container->createUrl('/space/space', [], true),
|
||||
'description' => Helpers::trimText($this->container->description, 60)
|
||||
|
||||
|
||||
]);
|
||||
} elseif ($this->container instanceof \humhub\modules\user\models\User) {
|
||||
return $this->render('mailContentContainerInfoBox', [
|
||||
'container' => $this->container,
|
||||
'url' => $this->container->createUrl('/user/profile', [], true),
|
||||
'description' => Helpers::trimText($this->container->profile->title, 60)
|
||||
|
||||
'description' => Helpers::trimText($this->container->displayNameSub, 60)
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ use yii\helpers\Html;
|
||||
</td>
|
||||
<?php else : ?>
|
||||
<td height="15" style="font-size: 15px; line-height: 22px; font-family:Open Sans,Arial,Tahoma, Helvetica, sans-serif; color:<?= Yii::$app->view->theme->variable('text-color-soft2', '#aeaeae') ?>; font-weight:300; text-align:left; ">
|
||||
<?= Html::encode($originator->profile->title); ?>
|
||||
<?= Html::encode($originator->displayNameSub); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user