2

I have a little problem on one of my Joomla website. I had to delete the Forgot Password... the 2/3 Links that appears under the login module. They're gone now, but still there is 3 <li> section, so 3 little dots I can't remove. How can I change that ?

The bug :
enter image description here

Thanks

  • How did you delete them? – Farahmand Sep 8 '14 at 13:53
  • I deleted the line 56 to end in default_login.php(components/com_users/views/login/tmpl/) – Nicolas Charvoz Sep 8 '14 at 13:56
  • Login module or login component? Is it a part of a page or a whole login page? – Farahmand Sep 8 '14 at 14:02
  • It's a component . Yeah sorry for the mistake .. – Nicolas Charvoz Sep 8 '14 at 14:04
6

Rather than delete this functionality, the best thing to do would be to disable it.

To do this, in your backend go to:

http://YOURSITE.com/index.php?option=com_config&view=component&component=com_users

In the first option which appears, set "Allow User Registration" to No

Once you've done this, you need to create an override in your Joomla template. Simply go to the backend of your site (via FTP) and browse to:

modules/mod_login/tmpl/default.php and copy (be sure not to move it) this file into:

/templates/YOURTEMPLATE/html/mod_login/default.php (If mod_login isn't a folder, just create it).

Once you have got the file in there, open it in your favourite editor and remove the following:

<ul>
    <li>
        <a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>">
        <?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
    </li>
    <li>
        <a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
        <?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?></a>
    </li>
    <?php
    $usersConfig = JComponentHelper::getParams('com_users');
    if ($usersConfig->get('allowUserRegistration')) : ?>
    <li>
        <a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>">
            <?php echo JText::_('MOD_LOGIN_REGISTER'); ?></a>
    </li>
    <?php endif; ?>
</ul>

The above is roughly lines 60 -> 77

That should then revolve it!

Update

If you want to override the user login component, you need to copy the file from

/components/com_users/views/login/tmpl/default_login.php

to

/templates/YOURTEMPLATE/html/com_users/login/default_login.php

and remove this part from the copied file:

<div>
    <ul>
        <li>
            <a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>">
            <?php echo JText::_('COM_USERS_LOGIN_RESET'); ?></a>
        </li>
        <li>
            <a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
            <?php echo JText::_('COM_USERS_LOGIN_REMIND'); ?></a>
        </li>
        <?php
        $usersConfig = JComponentHelper::getParams('com_users');
        if ($usersConfig->get('allowUserRegistration')) : ?>
        <li>
            <a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>">
                <?php echo JText::_('COM_USERS_LOGIN_REGISTER'); ?></a>
        </li>
        <?php endif; ?>
    </ul>
</div>

About line 57 ~ 76.

  • I got a 404 with this .. – Nicolas Charvoz Sep 8 '14 at 14:05
  • With what? The above URL? You need to replace the YOURSITE.com with yoursite URL – RustyJoomla Sep 8 '14 at 14:06
  • Just try to modify the file, but it doesn't work the dots are still there – Nicolas Charvoz Sep 8 '14 at 14:14
  • Check your spelling of mod_login folder within the /html/ folder of your template and the default.php file This could possibly be causing the issue. – RustyJoomla Sep 8 '14 at 14:20
  • mod_login and default.php Do you see any mistake I cannot see ? – Nicolas Charvoz Sep 8 '14 at 14:22
2

First of all, don't change any of the Joomla core files, your changes will be lost when you update Joomla.

To remove the User Registration option, go to Users -> User Manager in your Joomla admin area, and click Options in the upper right corner. Then set Allow User registration to No. This will completely disable the user registration option. (You can still create new users from the Joomla backend).

Joomla User Manager

As for removing Forgot your username and Forgot your password, I would simply use CSS to hide it.

In your template's custom.css file (or similar), add the following code to hide the links in question:

.login + div {
   display: none;
}

Note:
The login component seems to render these links in <div> and <li> tags without any class or ID, thus making it impossible to target them directly using CSS. The above code will target any <div> tag that shows up immediately after the <div class="login "> block, thus hiding the links.

Keep in mind that even if the links are hidden, the functions can be accessed by using a direct URL.

Forgot your password?
http://example.com/index.php?option=com_users&view=reset

Forgot your username?
http://example.com/index.php?option=com_users&view=remind

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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