File tree 4 files changed +24
-23
lines changed
4 files changed +24
-23
lines changed Original file line number Diff line number Diff line change @@ -325,9 +325,14 @@ public function actionProfile($id = null)
325
325
]);
326
326
}
327
327
328
- public function actionEditProfile ()
328
+ public function actionEditProfile ($ id = null )
329
329
{
330
- $ model = Yii::$ app ->user ->identity ;
330
+ // if the current user's profile
331
+ if (empty ($ id )) {
332
+ $ model = Yii::$ app ->user ->identity ;
333
+ } else {
334
+ $ model = $ this ->findModel ($ id );
335
+ }
331
336
332
337
$ settings = UserSettingsConfig::find ()->where ([
333
338
'access_level ' => [1 , 2 ]
Original file line number Diff line number Diff line change 29
29
<div class="white-block">
30
30
<?= $ form ->field ($ model , 'name ' )->textInput (['maxlength ' => true ]) ?>
31
31
32
+ <?php if (Yii::$ app ->user ->identity ->hasRole ('admin ' )) {?>
33
+ <div class="row">
34
+ <div class="col-md-4">
35
+ <?= $ form ->field ($ model , 'username ' )->textInput (['maxlength ' => true ]) ?>
36
+ </div>
37
+ <div class="col-md-4">
38
+ <?= $ form ->field ($ model , 'email ' )->textInput (['maxlength ' => true ]) ?>
39
+ </div>
40
+ <div class="col-md-4">
41
+ <?= $ form ->field ($ model , 'status ' )->dropDownList (User::getStatusList ()) ?>
42
+ </div>
43
+ </div>
44
+ <?php } ?>
45
+
32
46
<div class="row">
33
47
<div class="col-md-3">
34
48
<?= $ form ->field ($ model , 'city ' )->textInput (['maxlength ' => true ]) ?>
Original file line number Diff line number Diff line change 281
281
if ($ action == 'view ' ) {
282
282
return Url::toRoute (['profile ' , 'id ' => $ model ->id ]);
283
283
}
284
+ if ($ action == 'update ' ) {
285
+ return Url::toRoute (['edit-profile ' , 'id ' => $ model ->id ]);
286
+ }
284
287
return Url::toRoute ([$ action , 'id ' => $ model ->id ]);
285
288
}
286
289
],
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments