How to change login form in Joomla?

I was wondering how you can change the text in the Joomla login form. For instance:

From Username to Usr from Password to Pwd , and other text.

This question may have been asked before, but I did not find anything.

Does anyone know how to do this?

+6
source share
2 answers

You can do this by overriding the template, but it will not gracefully handle changes to the template from the upgrade, and you assume that new lines should be directly in the template, which will prevent multilingualism from being easily used.

The correct way to do this (as indicated in adjamaflip) is through language files.

The main login page for Joomla is through the com_users component, although there is also the mod_login module mentioned by hbit. This process will work for both, they will just have several different files and lines to override (you probably want to override both).

If you look at the templates for any component or module, you will see that they have these sections of code:

<?php echo JText::_('MOD_LOGIN_VALUE_USERNAME') ?> <?php echo JText::_('COM_USERS_LOGIN_USERNAME_LABEL') ?> 

It basically says: "Paste the translated text here for WHATEVERSTRING." This translated text is saved in the corresponding language file, which will be located in '/language/LANG/LANG.com_users.ini' for the com_users component, etc. LANG is en-GB by default, so probably for you in '/language/en-GB/en-GB.com_users.ini' you will find a line like:

 COM_USERS_LOGIN_USERNAME_LABEL="User Name" 

Now you can edit this file right there. It will be displayed immediately on your website and will process a multilingual language. But then again, it would not be very well preserved during the upgrade (if Joomla releases a new version that changes this language file, it will destroy your changes).

To handle updates, they added a new feature in Joomla 1.6 to override the language. You can add overrides for ANY language file (any component / module / etc) to a separate override location in '/language/overrides/LANG.override.ini'. For example, add the line:

 COM_USERS_LOGIN_USERNAME_LABEL="Usr" 

You have now redefined this line of language. Add lines for "MOD_LOGIN_VALUE_USERNAME", etc., to change the input module and other lines if necessary.

Now, if you update Joomla, you will make any changes to these login templates, but will not lose your text changes. You can apply the same process to each language your site is hosted, overrides will live happily side by side. This will also work for third-party components and modules if they use "JText :: _ ()" to output the string that they should be.

+10
source

You do this with what are called template overrides. You basically copy the file (where your form is displayed) to the template directory of your active template. For the login form, you should look like this:

Copy

[Joomla] /modules/mod_login/tmpl/default.php

to

[joomla] / templates / [the template you use] /html/mod_login/default.php

It is important to create (if not) and use the "html" directory in the templates directory. Then you edit the new default.php as you want. The idea is that you are not editing the main files, as this is bad practice.

Here's more information about overriding a template: How to override output from Joomla! the main

+3
source

Source: https://habr.com/ru/post/896381/


All Articles