Page 1 of 1

mod_login Modification hide/show link

Posted: Sat Mar 29, 2008 9:09 pm
by pgruhn
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; ?>

Re: mod_login Modification hide/show link

Posted: Thu May 22, 2008 10:49 am
by denis001
Thanks,

Works Great!

Spent Hours Looking For Something Like This

Re: mod_login Modification hide/show link

Posted: Sat May 31, 2008 1:12 pm
by piaf666
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

Re: mod_login Modification hide/show link

Posted: Mon Jul 07, 2008 4:52 pm
by mariewhitehead
The last suggestion to create a menu item worked great! 8)

Re: mod_login Modification hide/show link

Posted: Sat Jul 12, 2008 11:07 pm
by mohamed hameed
thanks

Re: mod_login Modification hide/show link

Posted: Sun Jul 13, 2008 12:34 pm
by ianmac
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