Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to Send message when logout
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
alikon  
View profile  
 More options Jul 28 2012, 2:04 am
From: alikon <i...@alikonweb.it>
Date: Fri, 27 Jul 2012 23:04:33 -0700 (PDT)
Local: Sat, Jul 28 2012 2:04 am
Subject: how to Send message when logout

hi,all
i've the need under some circumstances  to force user logout , and inform
for the reason of logout

i was able to force logout with
$app = JFactory::getApplication();
$app->logout();

but i was unable to display the info  
can someone  help me
thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TDZWeb  
View profile  
 More options Jul 28 2012, 8:14 am
From: TDZWeb <webmas...@tdzwebdesign.no>
Date: Sat, 28 Jul 2012 05:14:55 -0700 (PDT)
Local: Sat, Jul 28 2012 8:14 am
Subject: Re: how to Send message when logout

Seems like a job for a plugin using a combination the event onLogoutUser
and $app->enquemessage('haha logged you out! :)'). Give it a try.

http://docs.joomla.org/Plugin/Events/User#onLogoutUser

kl. 08:04:33 UTC+2 lørdag 28. juli 2012 skrev alikon følgende:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alikon  
View profile  
 More options Jul 29 2012, 1:01 am
From: alikon <i...@alikonweb.it>
Date: Sat, 28 Jul 2012 22:01:35 -0700 (PDT)
Local: Sun, Jul 29 2012 1:01 am
Subject: Re: how to Send message when logout

i've already tryied  with the onUserLogout (i'm on 2.5) event
with enqueueMessage(),JError::raiseWarning
both no luck at all, user logged out but no message showed

instead using Jerror::raiseError  the message is showed  but the user is
not logged out

other ideas ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TDZWeb  
View profile  
 More options Jul 29 2012, 4:22 am
From: TDZWeb <webmas...@tdzwebdesign.no>
Date: Sun, 29 Jul 2012 01:22:03 -0700 (PDT)
Local: Sun, Jul 29 2012 4:22 am
Subject: Re: how to Send message when logout

Does it have to be a personalized message or can it be general? I realize
that since the app->logout probably wipes the session it forgets any
enqueued messages and resets the application. You could try to redirect the
user to a generic "You were logged out because of this" page.

kl. 07:01:35 UTC+2 søndag 29. juli 2012 skrev alikon følgende:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alikon  
View profile  
 More options Jul 31 2012, 1:35 am
From: alikon <i...@alikonweb.it>
Date: Mon, 30 Jul 2012 22:35:28 -0700 (PDT)
Local: Tues, Jul 31 2012 1:35 am
Subject: Re: how to Send message when logout

your solution could be acceptable   (Do you mean to redirect  to an article
?)
even if need some extra work  on extension configuration, it needs another
parameter the article id
it was better something like this:
 $app->logout('loggedout for reason: '.$reason)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arryn Flynn  
View profile  
 More options Jul 31 2012, 8:34 am
From: Arryn Flynn <jrdlind...@gmail.com>
Date: Tue, 31 Jul 2012 05:34:59 -0700 (PDT)
Local: Tues, Jul 31 2012 8:34 am
Subject: Re: how to Send message when logout

I agree with TDZWeb.  The plugin method is the best solution; you just need
to make it work. Bear in mind that the plugins must return success or the
logout sequence will fail.  In fact, the entire plugin chain must succeed
for the login/logout to be successful.  Is your plugin event handler
returning a success value?  To test this, just disable your plugin and see
if you can logout again.

I think $app->enqueMessage only displays when followed by a redirect, e.g.,
$app->redirect(url, msg)

El sábado, 28 de julio de 2012 02:04:33 UTC-4, alikon escribió:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
subtextproductions  
View profile  
 More options Aug 1 2012, 3:34 pm
From: subtextproductions <alonzo.tur...@subtextproductions.com>
Date: Wed, 1 Aug 2012 12:34:34 -0700 (PDT)
Local: Wed, Aug 1 2012 3:34 pm
Subject: Re: how to Send message when logout

I was thinking about this problem and I had an idea along the lines of
TDZWeb. Instead of logging the user out and redirecting them to a content
page or other generic page, maybe you can redirect the user to another page
for further processing. For example, look at this code:

$app->logout();
$app->redirect(JRoute::_('index.php?option=mycomponent&view=mymessagequeue& myvar=1'));

After the application logs the user out and the page reloads, the message
queue gets wiped out. So, how about instead set an extra variable in your
redirect. Use this extra variable to determine the message you want to
display to the end user. Then in your view.html.php file for the
mymessagequeue view, add some code like this:

$myvar = JRequest::getInt('myvar');
switch($myvar){
case 1:
  $mymessage = "MESSAGE 1";
  break;
case 2:
  $mymessage = "MESSAGE 2";
  break;
case 3:
  $mymessage = "MESSAGE 3";
  break;

}

$app->redirect(JRoute::_('index.php?option=mycomponent&view=myview',
$mymessage);

Here the user is redirected twice after logout. The first time the user is
redirected the application's message queue and user session are cleared
out. The second time the user is redirected, a message is set for the guest
user and the message queue should retain it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alikon  
View profile  
 More options Aug 2 2012, 1:26 am
From: alikon <i...@alikonweb.it>
Date: Wed, 1 Aug 2012 22:26:29 -0700 (PDT)
Local: Thurs, Aug 2 2012 1:26 am
Subject: Re: how to Send message when logout

i'm on a plugin and don't have a component....


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TDZWeb  
View profile  
 More options Aug 2 2012, 6:03 am
From: TDZWeb <webmas...@tdzwebdesign.no>
Date: Thu, 2 Aug 2012 03:03:44 -0700 (PDT)
Local: Thurs, Aug 2 2012 6:03 am
Subject: Re: how to Send message when logout

I don't think you would need a custom component. You could try to redirect
to an article with:
$app->logout();
$app->redirect(JRoute::_('index.php?option=com_content&view=article&id=ARTI CLE
ID'));

I sometimes make an 'invisible' system menu (not assigned to any module)
with individual articles (often in a category I call 'System') that I use
for similar purposes, ie. display system messages. That way you can get
prettier/more sensible urls and breadcrumbs.

If you want to have a conditional message you must do something to bridge
the logout. It seems to me that subtextproductions 's suggestion is the
easiest way to do that. Maybe its time to do the component tutorial? It
should have everything you need :)
http://docs.joomla.org/Developing_a_Model-View-Controller_(MVC)_Compo...

kl. 07:26:29 UTC+2 torsdag 2. august 2012 skrev alikon følgende:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Moffatt  
View profile  
 More options Aug 2 2012, 12:15 pm
From: Sam Moffatt <pasa...@gmail.com>
Date: Thu, 2 Aug 2012 09:15:34 -0700
Local: Thurs, Aug 2 2012 12:15 pm
Subject: Re: [jgen] Re: how to Send message when logout
If you had a system plugin you could concievably use it to detect
request URL params for yourself and set the message in the guest
session after the logout however you're perhaps in a worse situation
than if you had a component because it'll add a load to every page
load in the site. The component is perhaps the best way with the
architecture we have right now.

Cheers,

Sam Moffatt
http://pasamio.id.au


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alikon  
View profile  
 More options Aug 2 2012, 2:47 pm
From: alikon <i...@alikonweb.it>
Date: Thu, 2 Aug 2012 11:47:02 -0700 (PDT)
Local: Thurs, Aug 2 2012 2:47 pm
Subject: Re: [jgen] Re: how to Send message when logout

so summarizing

   1.  use an article (com_content) for redirect the message
   2.  use a component (com_custom) for redirect the message
   3.  detect request URL params for yourself and set the message in the
   guest session after the logout

the  first
need some webmaster work could be not suitable for a good extension

the second
seems more userfriedly for the end user, more work  for developer

the third
is the most interesting for me cause i don't know how to code it, can you
help me  explaining a bit more this

i would prefer third, the plugin solution

do you agree?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
subtextproductions  
View profile  
 More options Aug 2 2012, 3:40 pm
From: subtextproductions <alonzo.tur...@subtextproductions.com>
Date: Thu, 2 Aug 2012 12:40:15 -0700 (PDT)
Local: Thurs, Aug 2 2012 3:40 pm
Subject: Re: how to Send message when logout

The logic still holds true even if you aren't using a component. You can
use a plugin to accomplish the exact same goal. The point is that you have
to redirect twice. The first time you redirect, all session information is
destroyed, so you can't count on any information stored by the User. You
need to pass a variable through the URL, that's how information gets passed
from page to page when you don't have sessions to fall back on. Then, you
need a second script to process the variable you set in the URL. By the
way, logout always looks for a variable named "return" in the global
$_REQUEST, and expects it to be a base64 encoded URL. If you use this, you
don't even have to handle the initial redirect, it will just happen
automatically.

For example, at some point in your code, for whatever reason you have
decided to logout the user. This is what your code should look like for the
actual logout:

// SET THE RETURN VARIABLE IN GLOBAL REQUEST BEFORE YOU LOG OUT THE USER
JRequest::setVar('return',
base64_encode('index.php?special_condition='.$x));
$app->logout();

After the logout is fired, the system will automatically redirect the user
to the URL specified by 'return' in the $_REQUEST. Now, instead of a User
plugin, this should be a system plugin, because it will fire every time the
page is loaded. We are going to use the onAfterInitialise event because it
will give us everything we need but it will take place before any page
rendering:

function onAfterInitialise(){
  $some_condition = JRequest::getInt('special_condition', 0, 'GET');
  switch($some_condition){
  case 1:
    $message = "MESSAGE 1";
    break;
  case 2:
    $message = "MESSAGE 2";
    break;
  case 3:
    $message = "MESSAGE 3";
    break;
  default:
    // DO NOTHING BECAUSE THE SPECIAL CONDITION ISN'T SET
    return true;
  }
  // IF THE MESSAGE WAS SET, REDIRECT AND APPEND THE MESSAGE
  $app = JFactory::getApplication();
  $app->redirect('index.php', $message);


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TDZWeb  
View profile  
 More options Aug 2 2012, 4:41 pm
From: TDZWeb <webmas...@tdzwebdesign.no>
Date: Thu, 2 Aug 2012 13:41:09 -0700 (PDT)
Local: Thurs, Aug 2 2012 4:41 pm
Subject: Re: how to Send message when logout

"By the way, logout always looks for a variable named "return" in the
global $_REQUEST, and expects it to be a base64 encoded URL. If you use
this, you don't even have to handle the initial redirect, it will just
happen automatically. "

This is very useful. I can see making a custom logout plugin myself.
Brillant and thx :)

kl. 21:40:15 UTC+2 torsdag 2. august 2012 skrev subtextproductions følgende:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alikon  
View profile  
 More options Aug 3 2012, 7:21 am
From: alikon <i...@alikonweb.it>
Date: Fri, 3 Aug 2012 04:21:55 -0700 (PDT)
Local: Fri, Aug 3 2012 7:21 am
Subject: Re: how to Send message when logout

maybe i'm doing something  wrong
but non msg appear cause never $some_condition have something that differs
from 0

p.s
i'm on a system plugin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »