? ?
avatar sandewt
sandewt
25 Sep 2020

Steps to reproduce the issue

Improve proposal: new feature.

Expected result

There is showing a message after a logout. (Optional)

screen shot 2020-09-25 at 12 43 12

Actual result

There is NOT showing a message after logout.

System information (as much as possible)

Is not applicable.

Additional comments

Earlier I wanted to introduce this in Joomla 3.x.
Apparently there was no need for that.
See #19477.

I want to re-evaluate this new feature for J4. @Quy.

avatar sandewt sandewt - open - 25 Sep 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Sep 2020
avatar alikon alikon - change - 25 Sep 2020
Labels Added: ?
avatar alikon alikon - labeled - 25 Sep 2020
avatar sandewt
sandewt - comment - 26 Sep 2020

The easiest way is to add a small piece of code to the system plugin logout.
But I don't know if that's allowed !?
In any case, it seems to work fine.

\plugins\system\logout\logout.php

public function onUserLogout($user, $options = array())
{
	if ($this->app->isClient('site'))
	{
		// Create the cookie.
		// .....

		// Get a message after logout.
		if ((int) $this->params->get('show_message', 1)) // option
		{
			$this->app->enqueueMessage(Text::_('PLG_SYSTEM_LOGOUT_MESSAGE'), 'message');
		}
	}

	return true;
}
avatar adj9
adj9 - comment - 26 Sep 2020

The login message may be useful. I would also set a login message.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30767.

avatar sandewt
sandewt - comment - 26 Sep 2020

The login message may be useful. I would also set a login message.

But then as an option in the settings..

avatar infograf768
infograf768 - comment - 26 Sep 2020

To consider:
When logging out from a page which access was restricted to the group the user was set to, we get an error page as a 404.

avatar brianteeman
brianteeman - comment - 26 Sep 2020

enqueue message should still work

avatar sandewt
sandewt - comment - 27 Sep 2020

For a simpler and better control structure, the User - Joomla! plugin seems now to be a better option.

Moreover, it is now possible to generate a login and/or a logout message for the backend and frontend.

file: \Joomla\plugins\user\joomla\joomla.php

public function onUserLogin($user, $options = [])
{
	....

	// Show a message when the user is actually logged in.
	if ((int) $this->params->get('message_login', 0) && Factory::getUser()->get('id') > 0)
	{
		$this->app->enqueueMessage(Text::_('PLG_USER_JOOMLA_MESSAGE_LOGIN'), 'message');
	}

	return true;
}

public function onUserLogout($user, $options = [])
{
	...

	// Show a message when the user is actually logged out.
	if ((int) $this->params->get('message_logout', 0) && Factory::getUser()->get('id') === 0)
	{
		$this->app->enqueueMessage(Text::_('PLG_USER_JOOMLA_MESSAGE_LOGOUT'), 'message');
	}

	return true;
}

new_feature_messages_1
new_feature_messages_3
new_feature_messages_2

avatar HLeithner
HLeithner - comment - 27 Sep 2020

Actually I think you don't need an option for logout and the location should be in the com_users controller logout function no need to do this in the joomla user plugin.

I see no useful information in a login message but ok.

avatar sandewt
sandewt - comment - 27 Sep 2020

Actually I think you don't need an option for logout and the location should be in the com_users controller logout function no need to do this in the joomla user plugin.

Sounds logical, but I know more about plugins. Hence.
The changes I suggest here with built-in controls are very easy to implement.
I know that shouldn't be an argument.

I see no useful information in a login message but ok.
The login message may be useful. I would also set a login message.

[EDIT] Much of such logic is handled in the plugins!

avatar sandewt
sandewt - comment - 27 Sep 2020

Question: Where are the return true statements handled in the (com_users) controller?

file: \Joomla\plugins\user\joomla\joomla.php

public function onUserLogin($user, $options = [])
{
	....	

	return true;
}

public function onUserLogout($user, $options = [])
{
	....

	return true;
}
avatar sandewt
sandewt - comment - 27 Sep 2020

Question: Where are the return true statements handled in the (com_users) controller?

In the meantime I found out that this functionality can easily be put in \components\com_users\src\Controller\UserController.php for the frontend.

Backend? Necessary?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30767.
avatar sandewt
sandewt - comment - 28 Sep 2020

Placing the logic in UserController.php and changing config.xml let's see:

  • Frontend Login Message (default = Hide)
  • Frontend Logout Message (default = Hide)

Users: Options

new_feature_messages_4

[EDIT] Hide should be No

avatar alikon
alikon - comment - 1 Oct 2020

please test #30834

avatar alikon alikon - close - 1 Oct 2020
avatar alikon alikon - change - 1 Oct 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-10-01 09:21:47
Closed_By alikon

Add a Comment

Login with GitHub to post a comment