Проверка на авторизацию Joomla3

More
8 years 4 months ago #5268 by Дмитрий Малыш
Здравствуйте.
При проверке на авторизацию пользователя:
$user = JFactory::getUser();
if ($user->guest)
echo "true";
else
echo "false";
всегда выдает true, хотя захожу под зарегистрированным пользователем.
В чем может быть проблема?

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #5269 by Дмитрий Малыш
Разобрался.
Не хватало следующего кода:
<?php define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';
$app = JFactory::getApplication('site');
$app->execute();
?>

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #5273 by JoomLine
К какому нашему расширению это относится?

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum

Last from the forum

© 2010- JoomLine
The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. joomline.net is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

email: This email address is being protected from spambots. You need JavaScript enabled to view it.