Skip to content

Instantly share code, notes, and snippets.

@buluma
Forked from raramuridesign/gist:8858597
Created November 3, 2017 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buluma/a46e02ad92c7c7e50ca9f50f125fe57b to your computer and use it in GitHub Desktop.
Save buluma/a46e02ad92c7c7e50ca9f50f125fe57b to your computer and use it in GitHub Desktop.
Logout link for Joomla 1.5, 2.5 and 3.0
Joomla 1.5 Logout Link
<?php
$returnURL = base64_encode(JURI::root() . "");
$user =& JFactory::getUser();
echo 'Hi,'.$user->username;
?>
<a href="index.php?option=com_user&task=logout&return=<?php echo $returnURL; ?>">
<input type="button" name="Submit" class="button" value="Logout"></a>
Joomla 2.5 Logout Link
<a href="index.php?option=com_users&task=user.logout&<?php echo JUtility::getToken(); ?>=1">
<input type="button" name="Submit" class="button" value="Logout">
</a>
Joomla 3.1 Logout Link
//JUtility::getToken() has been removed in Joomla 3.0. Use JSession::getFormToken() instead.
<a href="index.php?option=com_users&task=user.logout&<?php echo JSession::getFormToken(); ?>=1">
<input type="button" name="Submit" class="button" value="Logout">
</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment