user->logout (method)

Return to Knowledgebase

Purpose

Logs out a user

Location

users/classes/User.php

Parameters

This function does not take any arguments

Example

$user->logout();

Further Documentation:

Logs out a user. Although you can use this method by calling
if ($user->isLoggedIn()) $user->logout(); 

Redirecting someone to users/logout.php is preferable because it also destroys sessions and runs any logout scripts that you may have created or decide to create in the future.