2

How do I load the Concrete5 5.7.4.2 environment in order to check if a user is logged in or registered? I used to do it in Concrete5 5.6 with the following code:

<?php
    require 'Slim/Slim.php';

    \Slim\Slim::registerAutoloader();

    include('helpers/adodb5/adodb.inc.php');
    include('../config/site.php');

    define("DIR_BASE",'..');
    define('C5_ENVIRONMENT_ONLY', true);
    define('REDIRECT_TO_BASE_URL', false);

    $GLOBALS['APP_UPDATED_PASSTHRU'] = true;

    include(DIR_BASE . "/index.php");

    Loader::library('authentication/open_id');

    date_default_timezone_set('America/Caracas');

    $usuario = new User();
    if($usuario->isRegistered()) {
        ///code if is logged in

But now I cannot use it with ver 5.7.4.2. The $usuario var contains an empty user object. Does it have to do with the namespacing?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Rafael Mora
  • 1,095
  • 2
  • 13
  • 21

1 Answers1

2

In Concrete5 5.7 you can check if the user's logged in via this method:

<?php
    $u = new User();
    if($u->isLoggedIn()) {
        echo 'Hello '.$u->getUserName();
    }
?>
Daniel Waghorn
  • 2,997
  • 2
  • 20
  • 33