Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions plugins/system/languagefilter/src/Extension/LanguageFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Joomla\CMS\Association\AssociationServiceInterface;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Event\Router\AfterInitialiseRouterEvent;
use Joomla\CMS\Event\User\AfterSaveEvent;
use Joomla\CMS\Event\User\BeforeSaveEvent;
use Joomla\CMS\Event\User\LoginEvent;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Language\Associations;
Expand Down Expand Up @@ -559,8 +562,10 @@ public function onPrivacyCollectAdminCapabilities()
*
* @since 1.6
*/
public function onUserBeforeSave($user, $isnew, $new)
public function onUserBeforeSave(BeforeSaveEvent $event)
{
$user = $event->getUser();

if (\array_key_exists('params', $user) && $this->params->get('automatic_change', 1) == 1) {
$registry = new Registry($user['params']);
$this->user_lang_code = $registry->get('language');
Expand All @@ -585,8 +590,11 @@ public function onUserBeforeSave($user, $isnew, $new)
*
* @since 1.6
*/
public function onUserAfterSave($user, $isnew, $success, $msg): void
public function onUserAfterSave(AfterSaveEvent $event): void
{
$user = $event->getUser();
$success = $event->getSavingResult();

if ($success && \array_key_exists('params', $user) && $this->params->get('automatic_change', 1) == 1) {
$registry = new Registry($user['params']);
$lang_code = $registry->get('language');
Expand Down Expand Up @@ -621,8 +629,10 @@ public function onUserAfterSave($user, $isnew, $success, $msg): void
*
* @since 1.5
*/
public function onUserLogin($user, $options = [])
public function onUserLogin(LoginEvent $event)
{
$user = $event->getArgument('subject');

if ($this->getApplication()->isClient('site')) {
$menu = $this->getApplication()->getMenu();

Expand Down