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

后端 未结 3 701
暗喜
暗喜 2020-12-21 11:09

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 fi

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 12:00

    I was able to leverage Griiettner's solution for Joomla 3. I wanted to not allow users to edit their email address in the profile edit screen on the frontend. I only modified it slightly, copy this file:

    components/com_users/models/forms/profile.xml

    to:

    /templates/YOUR_TEMPLATE/html/com_users/profile/forms/profile.xml

    Also copy this file:

    components/com_users/views/profile/tmpl/edit.php

    to:

    /templates/YOUR_TEMPLATE/html/com_users/profile/edit.php

    And put this code at the top of the edit.php file right after the:

    defined('_JEXEC') or die;

    I left out the $this->form->reset( true ); // to reset the form xml loaded by the view and only used this:

    // JOOMLA 3 if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); $this->form->loadFile( dirname(__FILE__) . DS . "forms" . DS . "profile.xml");

    This allowed me to keep the user profile information populated in the edit form. I then edited the profile.xml file and added:

    readonly="true"

    to the email1 and email2 fields. This prevents the user from editing.

提交回复
热议问题