/** * @inheritdoc */ public function attributeLabels() { $labels = parent::attributeLabels(); if ($this->userPlusModule->loginType == "username") { $labels['login'] = Yii::t('user', 'Username'); } else { $labels['login'] = Yii::t('user', 'Email'); } return $labels; }
<?php use yii\widgets\DetailView; use suckkay\userplus\base\models\UserAccounts; use yii\helpers\Html; ?> <div class="user-view"> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'login', ['attribute' => 'administrator', 'value' => $model['administrator'] ? "Yes" : "No"], ['attribute' => 'creator', 'format' => 'raw', 'value' => $model['creator'] == -1 ? "Created by Console" : $model['creator'] == -2 ? "User register by my self" : Html::a(UserAccounts::findOne($model['creator'])->login, ['/user/manager/view', 'id' => UserAccounts::findOne($model['creator'])->id], ["role" => "modal-remote"])], 'creator_ip', ['attribute' => 'blocked_at', 'value' => $model['blocked_at'] == null ? "Not blocked" : date("d/m/Y H:i:s", $model['blocked_at'])], ['attribute' => 'created_at', 'value' => date("d/m/Y H:i:s", $model['created_at'])], ['attribute' => 'updated_at', 'value' => $model['updated_at'] == -1 ? \Yii::t("user", "Never Update") : date("d/m/Y H:i:s", $model['updated_at'])]]]); ?> </div>
/** * Loads attributes to the user model. * @param UserAccounts $user */ protected function loadAttributes($user) { $user->setAttributes($this->attributes); }
public function scenarios() { $scenarios = parent::scenarios(); $scenarios['register'][] = 'username'; $scenarios['create'][] = 'username'; $scenarios['console-create'][] = 'username'; $scenarios['confirm'] = ['confirm_token', 'confirmed_at']; $scenarios['recovery'] = ['recovery_token']; $scenarios['reset-password'] = ['password']; return $scenarios; }