Joomla 3.9.14

I have an external script that allows users to register on my Joomla site. The code is below;




require_once JPATH_BASE .'/components/com_users/models/registration.php';

$model = new UsersModelRegistration();


$language = JFactory::getLanguage();
$language->load('com_users', JPATH_SITE);
$language->load('com_content', JPATH_ADMINISTRATOR);
$language->load('lib_joomla', JPATH_ADMINISTRATOR);

$username = 'adam';
$name = 'adam24';
$email = 'testmail@localhost.com';
$password = 'password';

$data = array( 
    'username' => $username,
    'name' => $name,
    'email1' => $email,
    'password1' => $password, // First password field
    'password2' => $password, // Confirm password field
    'groups'    =>array('10'),
    'block' => 0 

$result = $model->register($data);
$err = $model->get('_errors');



<form action="" method="post">
    <input name="name" type="text"> 
    <input name="username" type="text"> 
    <input name="email" type="email"> 
    <input name="password" type="password"> 
    <input name="password2" type="password"> 
    <button type="submit">Register</button>

This is working as expected, results are saved in my Joomla database. However there is an error displayed when I var_dump($err);. The error is;

array ( 0 => 'Joomla\CMS\Form\Form::getInstance() could not load file',)

What does this mean and how can I fix it? I don't know how or if this is having any affect on my registration process.

Do I need to create the html forms using the Joomla JForm class syntax? I'd prefer not to.

  • The error is being thrown when it tries to read the XML form definition file. When registration.php's register method is invoked, it invokes, getData, which in turn invokes getForm, which tries to load the form. Probably can't find it because JPATH_COMPONENT isn't pointing to the right spot. Can I ask a question out of simple curiosity? What's the problem this is trying to solve that just using Joomla's own user registration process doesn't solve? (Like I said, simple curiosity; I get curious when people go to a lot of effort to duplicate something that apparently exists.) – Arlen Jan 17 at 18:40

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.