Joomla 3: Remove Login Form from Offline Page in Joomla

Joomla 3: Remove Login Form from Offline Page in Joomla

While working with Joomla when you set your website in offline mode, you might come across a login form. This is quite ok and is a normal Joomla behavior for an offline state. However, you might want to get rid of this form and just show the message that your site is in an offline state or down for maintenance.

This is quite possible and is very easy to achieve. But please be aware, that any changes you will be making to this file will revert to its original state upon updating your core Joomla. So each time you update your Joomla, you will have to do these steps one more time in order to retain this time.

Before going any further, we highly recommend you to take a backup of your website in case of a mishap you can rest on your site to its original state. You may refer Our article on how to take a backup of your Joomla in simple steps.

Requirement

You’ll need to have access to the Joomla Core Files usually found through file manager from cPanel of your website. If you do not have access to the files, you may gain it by installing this great little extension Extplorer to access the files right from your Joomla Administration.

Resolution

  • Navigate to Templates >> Your Site Default Template in your Joomla Filesystem
  • Select the offline.php file and make an offline copy by downloading it in case of a mishap
  • Now edit the file and remove the following code from it:
<form action="<?php echo JRoute::_('index.php', true); ?>" method="post" id="form-login">
	<fieldset>
		<label for="username"><?php echo JText::_('JGLOBAL_USERNAME'); ?></label>
		<input name="username" id="username" type="text" title="<?php echo JText::_('JGLOBAL_USERNAME'); ?>" />
		<label for="password"><?php echo JText::_('JGLOBAL_PASSWORD'); ?></label>
		<input type="password" name="password" id="password" title="<?php echo JText::_('JGLOBAL_PASSWORD'); ?>" />
		<?php if (count($twofactormethods) > 1) : ?>
		<label for="secretkey"><?php echo JText::_('JGLOBAL_SECRETKEY'); ?></label>
		<input type="text" name="secretkey" id="secretkey" title="<?php echo JText::_('JGLOBAL_SECRETKEY'); ?>" />
		<?php endif; ?>
		<input type="submit" name="Submit" class="btn btn-primary" value="<?php echo JText::_('JLOGIN'); ?>" />
		<input type="hidden" name="option" value="com_users" />
		<input type="hidden" name="task" value="user.login" />
		<input type="hidden" name="return" value="<?php echo base64_encode(JUri::base()); ?>" />
		<?php echo JHtml::_('form.token'); ?>
	</fieldset>
</form>

Applies To: Joomla 2.x.x and Joomla 3.x.x.

Code tested on 3.9.12 as on 12/Oct.2019 Click here See it in action on Joomla 3.9.12

If you face any difficulty while deploying this fix, drop me a line and I will be happy to help you. Did you find it helpful? Drop a line and share it forward to help others. Have a nice day.

Advertisements

About Syed Hussaini

I am a business consultant with 15+ Years of extensive expertise in IT Services Management (ITSM), Team Management, Mentorship, Knowledge Management, and Business Operations. My involvement in a corporate environment and freelance projects, my career has thought me how to be more productive, proactive, and independent.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.