By crimle on Saturday, 19 February 2022
Replies 3
Likes 0
Views 738
Votes 0
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
Hey Chris,

Glad you like it! 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>
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
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
·
0 Likes
·
0 Votes
·
0 Comments
·
Great to hear Chris!
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post