From 470b492a3ca3e0b7d2766de6496c1cd3c2cb2057 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Tue, 24 May 2022 02:15:21 +0530 Subject: [PATCH] [Joomla 4.0] Fatal error on submitting Profile with CMS username/password --- CRM/Utils/System/Joomla.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index 18637f3c1c..2d163d17ac 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -38,10 +38,17 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { */ public function createUser(&$params, $mail) { $baseDir = JPATH_SITE; - require_once $baseDir . '/components/com_users/models/registration.php'; - $userParams = JComponentHelper::getParams('com_users'); - $model = new UsersModelRegistration(); + + if (version_compare(JVERSION, '4.0.0', 'ge')) { + $model = JFactory::getApplication()->bootComponent('com_users')->getMVCFactory()->createModel('Registration', 'Site'); + $model->set('data', new \stdClass()); + } + else { + require_once $baseDir . '/components/com_users/models/registration.php'; + $model = new UsersModelRegistration(); + } + $ufID = NULL; // get the default usertype -- 2.25.1