Saturday, 19 February 2022
  3 Replies
  740 Visits
0
Votes
Undo
Hi

I am enthusiastic about the new one-click logout button I found in the top right corner of the JEvents control panel. In my opinion the default logout procedure in Joomla 4 is not very user friendly, since you need to click then move the mouse down and then click once more. From the very first version of Joomla 4.0.0 I have been looking for a way to have a one-click logout. Now I found JEvents that is providing exactly this desired feature.

Of course it would be necessary to have this one-click logout button not only within the JEvents component. It should be visible everywhere in the Back-End. Could you give me a hint how this could be managed? Is there a little plugin that needs to be installed? Of course I am not able to write such an extension myself. But I would appreciate it very much.

Thank you and kind regards
Chris
2 years ago
·
#225017
Accepted Answer
0
Votes
Undo
Hey Chris,

Glad you like it! :D You sure can, actually all you need to do is override the core mod_user. So

Go to -> Administrator Templates -> Atum -> Create Overrides -> mod_user
Edit: html->mod_user->default.php

and replace it with the attached.

It will add a power button icon to the right of the user menu.


<?php
/**
* @package Joomla.Administrator
* @subpackage mod_user
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;

$hideLinks = $app->input->getBool('hidemainmenu');

if ($hideLinks)
{
return;
}

// Load the Bootstrap Dropdown
HTMLHelper::_('bootstrap.dropdown', '.dropdown-toggle');
?>
<div class="header-item-content dropdown header-profile">
<button class="dropdown-toggle d-flex align-items-center ps-0 py-0" data-bs-toggle="dropdown" type="button"
title="<?php echo Text::_('MOD_USER_MENU'); ?>">
<div class="header-item-icon">
<span class="icon-user-circle" aria-hidden="true"></span>
</div>
<div class="header-item-text">
<?php echo Text::_('MOD_USER_MENU'); ?>
</div>
<span class="icon-angle-down" aria-hidden="true"></span>
</button>
<div class="dropdown-menu dropdown-menu-end">
<div class="dropdown-header">
<span class="icon-user-circle icon-fw" aria-hidden="true"></span>
<?php echo Text::sprintf('MOD_USER_TITLE', $user->name); ?>
</div>
<?php $uri = Uri::getInstance(); ?>
<?php $route = 'index.php?option=com_users&task=user.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-user_details'; ?>
<a class="dropdown-item" href="/<?php echo Route::_($route); ?>">
<span class="icon-user icon-fw" aria-hidden="true"></span>
<?php echo Text::_('MOD_USER_EDIT_ACCOUNT'); ?>
</a>
<?php $route = 'index.php?option=com_users&task=user.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-accessibility'; ?>
<a class="dropdown-item" href="/<?php echo Route::_($route); ?>">
<span class="icon-universal-access icon-fw" aria-hidden="true"></span>
<?php echo Text::_('MOD_USER_ACCESSIBILITY_SETTINGS'); ?>
</a>
<?php $route = 'index.php?option=com_login&task=logout&' . Session::getFormToken() . '=1'; ?>
<a class="dropdown-item" href="/<?php echo Route::_($route); ?>">
<span class="icon-power-off icon-fw" aria-hidden="true"></span>
<?php echo Text::_('JLOGOUT'); ?>
</a>
</div>
<div class="header-item-content dropdown header-profile">
<a href="/<?php echo Route::_($route); ?>">
<span class="icon-power-off icon-fw" aria-hidden="true"></span>
</a>
</div>
</div>

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

2 years ago
·
#225017
Accepted Answer
0
Votes
Undo
Hey Chris,

Glad you like it! :D You sure can, actually all you need to do is override the core mod_user. So

Go to -> Administrator Templates -> Atum -> Create Overrides -> mod_user
Edit: html->mod_user->default.php

and replace it with the attached.

It will add a power button icon to the right of the user menu.


<?php
/**
* @package Joomla.Administrator
* @subpackage mod_user
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;

$hideLinks = $app->input->getBool('hidemainmenu');

if ($hideLinks)
{
return;
}

// Load the Bootstrap Dropdown
HTMLHelper::_('bootstrap.dropdown', '.dropdown-toggle');
?>
<div class="header-item-content dropdown header-profile">
<button class="dropdown-toggle d-flex align-items-center ps-0 py-0" data-bs-toggle="dropdown" type="button"
title="<?php echo Text::_('MOD_USER_MENU'); ?>">
<div class="header-item-icon">
<span class="icon-user-circle" aria-hidden="true"></span>
</div>
<div class="header-item-text">
<?php echo Text::_('MOD_USER_MENU'); ?>
</div>
<span class="icon-angle-down" aria-hidden="true"></span>
</button>
<div class="dropdown-menu dropdown-menu-end">
<div class="dropdown-header">
<span class="icon-user-circle icon-fw" aria-hidden="true"></span>
<?php echo Text::sprintf('MOD_USER_TITLE', $user->name); ?>
</div>
<?php $uri = Uri::getInstance(); ?>
<?php $route = 'index.php?option=com_users&task=user.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-user_details'; ?>
<a class="dropdown-item" href="/<?php echo Route::_($route); ?>">
<span class="icon-user icon-fw" aria-hidden="true"></span>
<?php echo Text::_('MOD_USER_EDIT_ACCOUNT'); ?>
</a>
<?php $route = 'index.php?option=com_users&task=user.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-accessibility'; ?>
<a class="dropdown-item" href="/<?php echo Route::_($route); ?>">
<span class="icon-universal-access icon-fw" aria-hidden="true"></span>
<?php echo Text::_('MOD_USER_ACCESSIBILITY_SETTINGS'); ?>
</a>
<?php $route = 'index.php?option=com_login&task=logout&' . Session::getFormToken() . '=1'; ?>
<a class="dropdown-item" href="/<?php echo Route::_($route); ?>">
<span class="icon-power-off icon-fw" aria-hidden="true"></span>
<?php echo Text::_('JLOGOUT'); ?>
</a>
</div>
<div class="header-item-content dropdown header-profile">
<a href="/<?php echo Route::_($route); ?>">
<span class="icon-power-off icon-fw" aria-hidden="true"></span>
</a>
</div>
</div>

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

2 years ago
·
#225023
0
Votes
Undo
Hi Tony

thank you so much for this perfect solution. It's easy and it works. :) I am absolutely happy!

Kind regards
Chris
2 years ago
·
#225029
0
Votes
Undo
Great to hear Chris!

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

  • Page :
  • 1
There are no replies made for this post yet.