Logout

Logout

{% logout %}

Signs out of the current profile. This is only applicable if the user is currently signed in using a profile.

{% logout flags? %}

{% logout
flags
 
One or more values. May use the variable arguments syntax.
%}

flags

clear_session
 
Specifies that all session information should be completely reset, including the session id, session start date, and any session properties that have been set
clear_cookies
 
Specifies that the cookies should be cleared. This will clear all cookies with the possible exception of the permissions cookie
clear_permissions
 
Specifies that all permissions should be immediately unset. This is not the same thing as denying permissions - they will simply be unspecified. If the site is configured to allow sessions by default then the session permission will be allowed
save_changes
 
If there are any changes to the profile attributes or settings, these changes will be saved before logging off if save_changes is specified. If save_changes is not specified then any changes to the profile settings and attributes will NOT be saved and will be lost

This method prevents the current page from being fast-cachable.

Related

{% gallery %}

{% articles %}

Examples

How to use the logout method with various flags

Copy

Simple Use Case: rely on default behavior

{% logout %}
Use the logout method to sign the user out of the current profile. If no additional flags are specified, the session, cookies, and permissions will remain intact. If your site uses specific session variables, cookies, or permissions for profiles, you may want to consider clearing these resources as well.

Logout and clear session

{% logout clear_session %}
Including the clear_session flag causes the current session to be completely reset, including the session id, session start date, the session history, and any session properties that have been set.

Logout and clear cookies

{% logout clear_cookies %}
Including the clear_cookies flag causes all of the current cookies except for the permissions cookie to be removed. The permission cookie is not cleared because it is used by Marketpath to manage permissions, but it can also be cleared using the clear_permissions flag.

Clean logout

{% logout clear_session clear_cookies clear_permissions %}
Log out and and reset the session, clear the cookies, and return the permissions to their default values (sessions may or may not be allowed by default depending on the site configuration).

Save changes before logout

{% logout save_changes %}
If there are any changes to the profile attributes or settings, these changes will be saved before logging off if save_changes is specified. If save_changes is not specified then any changes to the profile settings and attributes will NOT be saved and will be lost.