I’d like to override some files (.php and .xml) in /components/com_users/models. Can this even be done? Or should I try and make a modified/renamed copy of com_users?

What I am trying to do is: Remove the name field from the user profile and registration forms, replacing it with firstname and lastname. I also need to modify registration.php and profile.php, so that they stich together a name from $firstname . ' ' . $lastname, because Joomla relies on name to be set to something meaningful.

This actually works if I edit the respective files directly, but my changes will be lost with an upgrade to Joomla. How can I avoid this?


1 Answer 1


You should check Joomla Plugins and Events.

There are such events like onContentPrepareForm($form, $data) and (may be you'll want to use onContentPrepareData($context, $data) but you should be fine with the first one) where you can get $data and $form and modify the form in there with your own XML, like:

    /** @var JForm $form */

It will do override that you need.

And if you dig deep you'll be able to find some triggers in user store algorithm like onUserBeforeSave($user, $isnew, $data) where you can adjust current data with getting data from the request.

But if you'll be working not with user it may be a solution two just use system event like onAfterRoute like this:

JFactory::getApplication()->input->set('name',JFactory::getApplication()->input->get('firstname').' '.JFactory::getApplication()->input->get('lastname'));

Not the answer you're looking for? Browse other questions tagged or ask your own question.