I'm migrating my website to a new server and I'm facing a problem since then. Files are identical, so I have no clue.
I want to access the global user variable in a subfolder, which is a custom php site. Here is how I try to access it:
<?php
// require global settings
require_once 'globals.php';
require_once BACKEND_CORE_PATH . '/spoon/spoon.php';
// The domain to be used for session cookies
$cookie_domain = DOMAIN_COOKIE;
$base_url = DRUPAL_URL;
// require the bootstrap include
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
// Load Drupal
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// get the Drupal user
global $user;
All includes are working fine, but when i dump the $user variable I get the following (while I'm logged in). At least I guess all includes are working since I got no errors.
object(stdClass)#14 (6) {
["uid"]=>
int(0)
["hostname"]=>
string(13) "XX.XXX.XXX.XX"
["roles"]=>
array(1) {
[1]=>
string(14) "anonymous user"
}
["cache"]=>
int(0)
["session"]=>
string(0) ""
["timestamp"]=>
string(10) "1535128081"
}
Note: The XXX in the hostname is edited by me. Someone has a clue why it isn't working? Can
If I ever have this result ifdump $GLOBALS, i see all drupal isn't loaded correctly?info, but only users says i'm not logged in..
PS: This is Drupal 7