Пример #1
0
 public static function getUserInfo($model)
 {
     if ($model->author_id) {
         $userClass = \Yii::$app->getUser()->identityClass;
         $user = $userClass::findIdentity($model->author_id);
         return [$user->getAvatar(70, 70), $user->username];
     }
     return [User::getDefaultAvatar(64, 64), $model->username];
 }
Пример #2
0
?>

<?php 
$form = ActiveForm::begin(["options" => ["class" => "comment-form"]]);
?>
<div class="media"  <?php 
echo $model->parent_id ?: "id='comment-form'";
?>
>
  <div class="media-left">
    <a href="#">
    <?php 
if (\Yii::$app->getUser()->isGuest) {
    ?>
      <img class="media-object" style ="width: 54px; height: 54px;" src="<?php 
    echo \hass\user\models\User::getDefaultAvatar(64, 64);
    ?>
" >
        <?php 
} else {
    ?>
        <img class="media-object" style ="width: 54px; height: 54px;" src="<?php 
    echo \Yii::$app->getUser()->identity->getAvatar(70, 70);
    ?>
" >
        <?php 
}
?>
    </a>
  </div>
  <div class="media-body">