Fix user account events in admin controller

This commit is contained in:
Lorenzo Milesi
2019-07-01 18:17:53 +02:00
parent 765ced73f7
commit 4fc2c257df
3 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@
- Fix #290: Fix wrong email message for resending confirmation (tonydspaniard) - Fix #290: Fix wrong email message for resending confirmation (tonydspaniard)
- Enh #269: Added help documentation to console commands (tonydspaniard) - Enh #269: Added help documentation to console commands (tonydspaniard)
- Fix #244: Fix forced inclusion of a suggested class (tonydspaniard) - Fix #244: Fix forced inclusion of a suggested class (tonydspaniard)
- Fix user event triggering in admin controller (maxxer)
## 1.5.0 April 19, 2019 ## 1.5.0 April 19, 2019
- Fix: Fix condition in EmailChangeService (it was always false) (borisaeric) - Fix: Fix condition in EmailChangeService (it was always false) (borisaeric)

View File

@ -9,6 +9,8 @@ On Controllers
- **AdminController** - **AdminController**
- **UserEvent::EVENT_BEFORE_CREATE**: Occurs before a user has been created - **UserEvent::EVENT_BEFORE_CREATE**: Occurs before a user has been created
- **UserEvent::EVENT_AFTER_CREATE**: Occurs after a user has been created - **UserEvent::EVENT_AFTER_CREATE**: Occurs after a user has been created
- **UserEvent::EVENT_BEFORE_ACCOUNT_UPDATE**: Occurs before a user's account has been updated
- **UserEvent::EVENT_AFTER_ACCOUNT_UPDATE**: Occurs after a user's account has been updated
- **UserEvent::EVENT_BEFORE_PROFILE_UPDATE**: Occurs before a user's profile has been updated - **UserEvent::EVENT_BEFORE_PROFILE_UPDATE**: Occurs before a user's profile has been updated
- **UserEvent::EVENT_AFTER_PROFILE_UPDATE**: Occurs after a user's profile has been updated - **UserEvent::EVENT_AFTER_PROFILE_UPDATE**: Occurs after a user's profile has been updated
- **UserEvent::EVENT_BEFORE_CONFIRMATION**: Occurs before a user's email has been confirmed - **UserEvent::EVENT_BEFORE_CONFIRMATION**: Occurs before a user's email has been confirmed

View File

@ -160,11 +160,11 @@ class AdminController extends Controller
$this->make(AjaxRequestModelValidator::class, [$user])->validate(); $this->make(AjaxRequestModelValidator::class, [$user])->validate();
if ($user->load(Yii::$app->request->post())) { if ($user->load(Yii::$app->request->post())) {
$this->trigger(ActiveRecord::EVENT_BEFORE_UPDATE, $event); $this->trigger(UserEvent::EVENT_BEFORE_ACCOUNT_UPDATE, $event);
if ($user->save()) { if ($user->save()) {
Yii::$app->getSession()->setFlash('success', Yii::t('usuario', 'Account details have been updated')); Yii::$app->getSession()->setFlash('success', Yii::t('usuario', 'Account details have been updated'));
$this->trigger(ActiveRecord::EVENT_AFTER_UPDATE, $event); $this->trigger(UserEvent::EVENT_AFTER_ACCOUNT_UPDATE, $event);
return $this->refresh(); return $this->refresh();
} }