Hello,

I am trying to hook into the user systems for several small apps, but when I try to call the user id from the $GLOBALS variable will always crash the script.

$user = $GLOBALS['user'];
#works with the $user variable defined
$uid = $user['uid'];
#kills the script when the $uid variable is defined

or

$user = $GLOBALS['user']['uid'];
#this crashes the script as well

any ideas as to how to get the UID from the globals variable?

Comments

mmarchio’s picture

nevermind, I was referencing it as an array rather than an object. fixed.

DLBaker’s picture

Can you show us an example of the correct code?

- Dan.