mod_login Modification hide/show link

Forum closed, please submit your tips and tricks to: http://docs.joomla.org/Category:Tips_and_tricks
Locked
User avatar
pgruhn
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Mar 08, 2008 4:28 pm
Location: East Windsor, CT
Contact:

mod_login Modification hide/show link

Post by pgruhn » Sat Mar 29, 2008 9:09 pm

The mod_login username & password box is ugly. And one of my clients didn't want it shown, but to be able to link to it So I made a modifcation to the default.php as follows Works cleaning to hide & display the login box, there may be a better way to do this, but this one worked for me ... you can see it at http://www.oldhamstudios.com/site click the "login" link

I just wanted to offer something to the group since folks here have helped me in many ways.

- Paul

<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>

<?php if($type == 'logout') : ?>

<form action="index.php" method="post" name="login" id="form-login">
<?php if ($params->get('greeting')) : ?>
<div><?php echo JText::sprintf( 'HINAME', $user->get('name') ); ?></div>
<?php endif; ?>
<div align="center">
<input type="submit" name="Submit" class="button" value="<?php echo JText::_( 'BUTTON_LOGOUT'); ?>" />
</div>

<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="logout" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
</form>


<?php else : ?>

<script type="text/javascript" language="JavaScript"><!--

function viewLogin(d) {
document.getElementById(d).style.display = "";
document.getElementById('loginLink').style.display = "none";
}

function closeLogin(d) {
document.getElementById(d).style.display = "none";
document.getElementById('loginLink').style.display = "";

}
//--></script>

<div>

<div id="loginLink"><a href="javascript:viewLogin('loginDisplay')" style="text-decoration:none" >login</a></div>

<div id="loginDisplay" style=" display: none; border: medium solid rgb(101,102,102); width:160px; border-width: 1px">

<?php if(JPluginHelper::isEnabled('authentication', 'openid')) : ?>
<?php JHTML::_('script', 'openid.js'); ?>
<?php endif; ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-login" >
<?php echo $params->get('pretext'); ?>
<fieldset class="input">
<p id="form-login-username">
<label for="modlgn_username"><?php echo JText::_('Username') ?></label><br />
<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="18" />
</p>
<p id="form-login-password">
<label for="modlgn_passwd"><?php echo JText::_('Password') ?></label><br />
<input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="18" alt="password" />
</p>
<?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
<p id="form-login-remember">
<label for="modlgn_remember"><?php echo JText::_('Remember me') ?></label>
<input id="modlgn_remember" type="checkbox" name="remember" class="inputbox" value="yes" alt="Remember Me" />
</p>
<?php endif; ?>
<input type="submit" name="Submit" class="button" value="<?php echo JText::_('LOGIN') ?>" />
</fieldset>
<ul>
<li>
<a href="javascript:closeLogin('loginDisplay')">Close login Window</a>
</li>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=reset' ); ?>">
<?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>">
<?php echo JText::_('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_user&task=register' ); ?>">
<?php echo JText::_('REGISTER'); ?></a>
</li>
<?php endif; ?>
</ul>
<?php echo $params->get('posttext'); ?>

<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="login" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>

</div>
</div>

<?php endif; ?>

denis001
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu May 22, 2008 10:40 am

Re: mod_login Modification hide/show link

Post by denis001 » Thu May 22, 2008 10:49 am

Thanks,

Works Great!

Spent Hours Looking For Something Like This

piaf666
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat May 31, 2008 1:03 pm

Re: mod_login Modification hide/show link

Post by piaf666 » Sat May 31, 2008 1:12 pm

You can do this :
Go to Menus item
choose a menu type (Top menu for example)
click Add to add a menu link
Choose Internal Link > User > Connexion > Default Login Layout
...

It will add in the menu a link to a new page with the login box.

NB : Joomla 1.5

mariewhitehead
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun Nov 18, 2007 4:36 pm

Re: mod_login Modification hide/show link

Post by mariewhitehead » Mon Jul 07, 2008 4:52 pm

The last suggestion to create a menu item worked great! 8)

mohamed hameed
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Jul 12, 2008 10:51 pm

Re: mod_login Modification hide/show link

Post by mohamed hameed » Sat Jul 12, 2008 11:07 pm

thanks

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: mod_login Modification hide/show link

Post by ianmac » Sun Jul 13, 2008 12:34 pm

Take a look at Beez and you will see an example of using layout overrides. This allows you to do something similar, but you don't have to hack the core files. You can provide a new file in your template and then you are resistant as well to changes in the core code base.

That being said, you can also just use CSS to style the module.

There are lots of options, and by no means do you have to have the module on your home page anyway.

Ian


Locked

Return to “Submit Your Suggested Tips & Tricks to Docs.joomla.org now please.”