Override components/com_users/models/forms/login.xml - Joomla 2.5?

theoth picture theoth · Mar 24, 2012 · Viewed 7.3k times · Source

I've been trying to override the file login.xml but no matter what I try, the edited version in my template folder doesn't show up. How can I override this file?

Update

I have tried template/<templatename>/html/com_users/models/login.xml and other variations like template/<templatename>/html/com_users/models/forms/login.xml or template/<templatename>/html/com_users/forms/login.xml etc without any success.

Answer

Shaz picture Shaz · Mar 24, 2012

Here's a solution:

http://forum.joomla.org/viewtopic.php?t=583380#p2375649

I just tested it in Joomla 2.5.3 and it works.

Update

here is the solution copied from above URL

We can override output by using the normal template override feature. For me, I'm trying to override the login page. So, I'm taking a copy of /components/com_users/views/login/tmpl/default.php and putting it into /templates/beez_20/html/com_users/login.

Now take a copy of /components/com_users/models/forms/login.xml and place in /templates/beez_20/html/com_users/login as well.

Then edit /templates/beez_20/html/com_users/login/default.php and add at the top of the form (I added mine just after the form tag) the following lines of code:

// to reset the form xml loaded by the view
$this->form->reset( true );

// to load in our own version of login.xml
$this->form->loadFile( dirname(__FILE__) . DS . "login.xml");

Similarly you can safely edit /templates/beez_20/html/com_users/registration/registration.xml to modify the registration form.