Hello,
I'm trying to use a script to login in Joomla 4 programmatically. Therefore I'm using this:
Sadly it doesn't work. I don't get any errors but there is no login. Could you help me - what I have to edit here?
I'm trying to use a script to login in Joomla 4 programmatically. Therefore I'm using this:
Code:
use Joomla\CMS\Factory;use Joomla\CMS\Plugin\PluginHelper;use Joomla\Event\Dispatcher as EventDispatcher;$db = JFactory::getDbo();$q = "SELECT * FROM `#__users` WHERE id = ".$userid;$user = $db->setQuery($q)->loadAssoc(); $dispatcher = new EventDispatcher();// Initiate log in$options = array('action' => 'core.login.site', 'remember' => false);$results = $dispatcher->triggerEvent('onUserLogin', array($user, $options));
Statistics: Posted by Rusler — Sun Feb 04, 2024 2:37 pm