use app\models\Role; ?> <div class="user-form"> <?php // если пользователь модератор if (Yii::$app->user->identity->role_id == app\models\Role::getIdByName('moderator')) { ?> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'role_id')->dropDownList(ArrayHelper::map(role::find()->all(), 'id', 'name')); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'password')->passwordInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'full_name')->textInput(['maxlength' => true]); ?>