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: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)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
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'];
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));
"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