The Logout Page

Most (if not all) websites will have a link or button that allows a logged in user to log out, and Community Auth makes logging out very easy.

Take a look at the Examples controller, and you’ll see the logout method:

public function logout()

    // Set redirect protocol
    $redirect_protocol = USE_SSL ? 'https' : NULL;

    redirect( site_url( LOGIN_PAGE . '?logout=1', $redirect_protocol ) );

You will not necessarily need to customize this method, however, you will probably want to move it to a controller in your application. Once you do that, all you need to do is point your logout link to that method. Community Auth will log the user out, then redirect them to the login page.

Depending on settings you have made in config/authentication.php, the logged out user may or may not see the login form, but they should always see a message letting them know they have been logged out.