diff --git a/Events.php b/Events.php index 4ca8482..2dd4cfc 100644 --- a/Events.php +++ b/Events.php @@ -9,6 +9,7 @@ namespace humhub\modules\twofa; use humhub\components\Controller; +use humhub\helpers\ControllerHelper; use humhub\modules\admin\controllers\UserController as AdminUserController; use humhub\modules\admin\permissions\ManageUsers; use humhub\modules\twofa\events\BeforeCheck; @@ -18,6 +19,7 @@ use humhub\modules\user\controllers\AuthController; use humhub\modules\user\events\UserEvent; use humhub\modules\user\widgets\AccountMenu; +use humhub\modules\user\widgets\AccountSettingsMenu; use Yii; class Events @@ -118,14 +120,17 @@ public static function onProfileSettingMenuInit($event) } $menuRoute = explode('/', trim(TwofaUrl::ROUTE_USER_SETTINGS, '/')); - $isActiveMenu = MenuLink::isActiveState($menuRoute[0], $menuRoute[1]); + $isActiveMenu = ControllerHelper::isActivePath($menuRoute[0], $menuRoute[1]); - $event->sender->addItem([ + /* @var AccountSettingsMenu $menu */ + $menu = $event->sender; + + $menu->addEntry(new MenuLink([ 'label' => Yii::t('TwofaModule.base', 'Two-Factor Authentication'), 'url' => Yii::$app->user->identity->createUrl(TwofaUrl::ROUTE_USER_SETTINGS), 'isActive' => $isActiveMenu, 'sortOrder' => 300, - ]); + ])); if ($isActiveMenu) { AccountMenu::markAsActive('account-settings-settings'); diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 88bb78e..28d84a4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,7 @@ Changelog - Enh #86: Improved Module Test GitHub Actions - Enh #87: Implemented `module-coding-standards` - Fix #90: Use `MailStyleHelper` for safe email inline styling +- Fix #98: Remove deprecations 1.2.0 (August 27, 2025) ----------------------- diff --git a/drivers/BaseDriver.php b/drivers/BaseDriver.php index 14290e6..2af81b5 100644 --- a/drivers/BaseDriver.php +++ b/drivers/BaseDriver.php @@ -166,7 +166,7 @@ public function renderUserSettingsFile($params = []) ], $params); echo '