Quantcast
Viewing all articles
Browse latest Browse all 2081

Joomla! 4.x Coding • JUserHelper broken in 4.4.3

Hello,
i just updated my website from version 4.3.4 to 4.4.3 and my external php code, to retrive user information, is no longer working.

This is the code i'm using that runs like a charm on 4.3.4:

Code:

$dirj4=__DIR__."/../../";define('_JEXEC', 1);define('JPATH_BASE', $dirj4);require_once JPATH_BASE . '/includes/defines.php';require_once JPATH_BASE . '/includes/framework.php';$container = \Joomla\CMS\Factory::getContainer();$container->alias('session.web', 'session.web.site')    ->alias('session', 'session.web.site')    ->alias('JSession', 'session.web.site')    ->alias(\Joomla\CMS\Session\Session::class, 'session.web.site')    ->alias(\Joomla\Session\Session::class, 'session.web.site')    ->alias(\Joomla\Session\SessionInterface::class, 'session.web.site');$app = $container->get(\Joomla\CMS\Application\SiteApplication::class);\Joomla\CMS\Factory::$application = $app;$user = \Joomla\CMS\Factory::getApplication()->getSession()->get('user');$userId = $user->id;$userProfile = JUserHelper::getProfile( $userId );$username = $user->get('username');$name = $user->get('name');$email = $user->get('email');$institution = $userProfile->profile['address1'];
The error, after the upgrade to 4.4.3, comes from the JUserHelper::getProfile instance, originating from:

Symfony\Component\ErrorHandler\Error\
ClassNotFoundError
in /website/plugins/user/token/services/provider.php (line 38)

Code:

    {            $container->set(                PluginInterface::class,                function (Container $container) {                    $dispatcher = $container->get(DispatcherInterface::class);                    $plugin     = new Token(                        $dispatcher,                        (array) PluginHelper::getPlugin('user', 'token')                    );                    $plugin->setApplication(Factory::getApplication());                    $plugin->setDatabase($container->get(DatabaseInterface::class));
with this description:
"Attempted to load class "Token" from namespace "Joomla\Plugin\User\Token\Extension".
Did you forget a "use" statement for another namespace?"

I already tried to clear the cache removing autoload_psr4.php with no success.

Do you guys have any clue how to solve this?
Thanks in advance

Statistics: Posted by cacaominutro — Thu Feb 29, 2024 10:41 am



Viewing all articles
Browse latest Browse all 2081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>