0

I am using ( Joomla! 3.9.11)

define('_JEXEC', 1);    

define('JPATH_BASE', realpath(dirname(__FILE__) . '/..'));
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';


$application   = JFactory::getApplication('site');

jimport('joomla.plugin.helper');


$credentials                = array();
$credentials['username']    = 'user1';
$credentials['password']    = '1234';


$application->login($credentials);

$user = JFactory::getUser();

print_r($user);

My $user variable is empty and I don't know what I am doing wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.