Permalink
Browse files

[#29158] mod_login selects wrong layout when user is logged in

  • Loading branch information...
1 parent 94c13b1 commit 96c5a18ef42c9260c40cf181546a9d4b12a51b90 @elinw elinw committed with dextercowley Sep 25, 2012
View
@@ -31,6 +31,7 @@ $ -> Language fix or change
# [#29291] New version of sample_default.sql and sample_blog.sql. Thanks Elin.
# [#29256] Change Menu Item selction in modules from Chosen to a checkbox tree. Thanks Peter van Westen.
# [#29276] Installation spinners don't work correctly.
+ # [#29158] mod_login selects wrong layout when user is logged in. Thanks Elin.
24-Sep-2012 Jean-Marie Simonet
# [#29287] String Global Configuration appears as title of every component Options. Thanks Michael
@@ -17,12 +17,12 @@
$type = modLoginHelper::getType();
$return = modLoginHelper::getReturnURL($params, $type);
$user = JFactory::getUser();
+$layout = $params->get('layout', 'default');
-if ($type == 'logout')
+// Logged users must load the logout sublayout
+if (!$user->guest)
{
- require JModuleHelper::getLayoutPath('mod_login', $params->get('layout', 'logout'));
-}
-else
-{
- require JModuleHelper::getLayoutPath('mod_login', $params->get('layout', 'default'));
+ $layout .= '_logout';
}
+
+require JModuleHelper::getLayoutPath('mod_login', $layout);
@@ -1,31 +1,31 @@
-<?php
-/**
- * @package Joomla.Site
- * @subpackage mod_login
- *
- * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-defined('_JEXEC') or die;
-
-JHtml::_('behavior.keepalive');
-?>
-<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" id="login-form" class="form-vertical">
-<?php if ($params->get('greeting')) : ?>
- <div class="login-greeting">
- <?php if ($params->get('name') == 0) : {
- echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('name')));
- } else : {
- echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username')));
- } endif; ?>
- </div>
-<?php endif; ?>
- <div class="logout-button">
- <input type="submit" name="Submit" class="btn btn-primary" value="<?php echo JText::_('JLOGOUT'); ?>" />
- <input type="hidden" name="option" value="com_users" />
- <input type="hidden" name="task" value="user.logout" />
- <input type="hidden" name="return" value="<?php echo $return; ?>" />
- <?php echo JHtml::_('form.token'); ?>
- </div>
-</form>
+<?php
+/**
+ * @package Joomla.Site
+ * @subpackage mod_login
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+defined('_JEXEC') or die;
+
+JHtml::_('behavior.keepalive');
+?>
+<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" id="login-form" class="form-vertical">
+<?php if ($params->get('greeting')) : ?>
+ <div class="login-greeting">
+ <?php if ($params->get('name') == 0) : {
+ echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('name')));
+ } else : {
+ echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username')));
+ } endif; ?>
+ </div>
+<?php endif; ?>
+ <div class="logout-button">
+ <input type="submit" name="Submit" class="btn btn-primary" value="<?php echo JText::_('JLOGOUT'); ?>" />
+ <input type="hidden" name="option" value="com_users" />
+ <input type="hidden" name="task" value="user.logout" />
+ <input type="hidden" name="return" value="<?php echo $return; ?>" />
+ <?php echo JHtml::_('form.token'); ?>
+ </div>
+</form>

0 comments on commit 96c5a18

Please sign in to comment.