<p>It is not possible yet, but a quick plugin would make this possible. It would just be a controller with a logout action. You'd be able to call the action as a url with:</p>

<pre><code>/actions/[PluginHandle]/[ControllerName]/[ActionName]
</code></pre>

<p>Then you can logout the user the same way Craft does in their controller and edit the redirect as you see fit. Something like this:</p>

<pre><code>craft()-&gt;userSession-&gt;logout(false);
$this-&gt;redirect('?status=logout');
</code></pre>

<p>This would log them out and then send them to the homepage with a query attached to the end.</p>

CC BY-SA 3.0
2014-06-19T08:32:20.520Z
I've setup a simple plugin. My Controller is called DelaneyMethod_MembersControllor with an action called actionLogout. In my form I have this: delaneymethod/members/logout but I get "Page Not Found, Unable to resolve the request "delaneymethod/members/logout".
Sean Delaney
CC BY-SA 3.0
2014-06-19T08:35:21.537Z
I also see you have suggested /actions/[PluginHandle]/[ControllerName]/[ActionName] and not /[PluginHandle]/[ControllerName]/[ActionName] as action URL ?
Sean Delaney
CC BY-SA 3.0
2014-06-19T09:55:14.020Z
Hey Sean, Craft's controllers are triggered when the first URL segment is [‘actions’](http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing) (by default) . You can generate a URL using the actionUrl function, i.e. `{{ actionUrl('delaneyMethod/members/logout') }}`
Stuart Whitehead
CC BY-SA 3.0
2014-06-19T09:58:35.880Z
Yes, I know but I'm submitted a form in this case... and I have an action field.
Sean Delaney
CC BY-SA 3.0
2014-06-19T10:17:49.410Z
I've got it working. I was calling "delaneymethod/members/logout" not "delaneyMethod/members/logout". Simple things that the eye doesn't catch... Thanks.
Sean Delaney
CC BY-SA 3.0
2014-06-19T10:19:39.833Z
Ah right, okay. Is the controller spelt with an ‘o’ a typo in your first comment? Also you'll need to use the correct camelCasing for action URIs, i.e. ‘delaneyMethod/members/logout’ instead of ‘delaneymethod/members/logout’.
Stuart Whitehead
CC BY-SA 3.0
2014-06-19T10:20:10.640Z
Haha good stuff, glad you're sorted.
Stuart Whitehead
CC BY-SA 3.0
2014-06-12T16:01:31.417Z
2014-06-12T16:01:31.417Z
Bryan Redeagle
<p>When site members click logout they are taken back to the homepage.</p>

<p>I'd like to redirect the user back to the login page but with a "You're logged out" type of message.</p>

<p>Is something like this possible yet?</p>

<redirection>
Is it possible to show a successful logout message?
# Is it possible to show a successful logout message?

(Asked by: username_0 on 2014-06-12)

When site members click logout they are taken back to the homepage.

I'd like to redirect the user back to the login page but with a "You're logged out" type of message.

Is something like this possible yet?

**Tags:** redirection


---

## 1 answers

### Answer by username_1 on 2014-06-12. Score: 7 | Accepted answer

It is not possible yet, but a quick plugin would make this possible. It would just be a controller with a logout action. You'd be able to call the action as a url with:
/actions/[PluginHandle]/[ControllerName]/[ActionName]

Then you can logout the user the same way Craft does in their controller and edit the redirect as you see fit. Something like this:
craft()->userSession->logout(false);
$this->redirect('?status=logout');

This would log them out and then send them to the homepage with a query attached to the end.

> **Comments:**
> **username_0**: I've setup a simple plugin. My Controller is called DelaneyMethod_MembersControllor with an action called actionLogout. In my form I have this: delaneymethod/members/logout but I get "Page Not Found, Unable to resolve the request "delaneymethod/members/logout".  
> **username_0**: I also see you have suggested /actions/[PluginHandle]/[ControllerName]/[ActionName] and not /[PluginHandle]/[ControllerName]/[ActionName] as action URL ?  
> **username_2**: Hey Sean, Craft's controllers are triggered when the first URL segment is [‘actions’](http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing) (by default) . You can generate a URL using the actionUrl function, i.e. `{{ actionUrl('delaneyMethod/members/logout') }}`  
> **username_0**: Yes, I know but I'm submitted a form in this case... and I have an action field.  
> **username_0**: I've got it working. I was calling "delaneymethod/members/logout" not "delaneyMethod/members/logout". Simple things that the eye doesn't catch... Thanks.  
> **username_2**: Ah right, okay. Is the controller spelt with an ‘o’ a typo in your first comment? Also you'll need to use the correct camelCasing for action URIs, i.e. ‘delaneyMethod/members/logout’ instead of ‘delaneymethod/members/logout’.  
> **username_2**: Haha good stuff, glad you're sorted.  

---

