Skip to content

Commit

Permalink
Taking off the part for menu logout as it is already in #10249
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed May 7, 2016
1 parent 4d3ddb0 commit 34f5bbf
Showing 1 changed file with 3 additions and 53 deletions.
56 changes: 3 additions & 53 deletions components/com_users/controllers/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,60 +137,10 @@ public function logout()
public function menulogout()
{
// Get the ItemID of the page to redirect after logout
$app = JFactory::getApplication();
$itemid = $app->getMenu()->getActive()->params->get('logout');

// Get the language of the page when multilang is on
if (JLanguageMultilang::isEnabled())
{
if ($itemid)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('language')
->from($db->quoteName('#__menu'))
->where('client_id = 0')
->where('id =' . $itemid);

$db->setQuery($query);

try
{
$language = $db->loadResult();
}
catch (RuntimeException $e)
{
return;
}

if ($language !== '*')
{
$lang = '&lang=' . $language;
}
else
{
$lang = '';
}
$itemid = JFactory::getApplication()->getMenu()->getActive()->params->get('logout');

// URL to redirect after logout
$url = 'index.php?Itemid=' . $itemid . $lang;
}
else
{
// Logout is set to default. Get the home page ItemID
$lang_code = $app->input->cookie->getString(JApplicationHelper::getHash('language'));
$item = $app->getMenu()->getDefault($lang_code);
$itemid = $item->id;

// Redirect to Home page after logout
$url = 'index.php?Itemid=' . $itemid;
}
}
else
{
// URL to redirect after logout, default page if no ItemID is set
$url = $itemid ? 'index.php?Itemid=' . $itemid : JURI::root();
}
// URL to redirect after logout, default page if no ItemID is set
$url = $itemid ? 'index.php?Itemid=' . $itemid : JURI::root();

// Logout and redirect
$this->setRedirect('index.php?option=com_users&task=user.logout&' . JSession::getFormToken() . '=1&return=' . base64_encode($url));
Expand Down

0 comments on commit 34f5bbf

Please sign in to comment.