I know this is going to end up being a stupid question, but I have a problem that thus far I have been unable to find the answer to. I have Googled and even tried loading code up into XDEBUG and still can not find what I am looking for. My problem is this...I have a website that I am working on that started off using Drupal. The user database is all based in Drupal. What I am trying to do is tie Drupal's credential system into the pages that I am creating. Now what I do know is that when a user logs into Drupal is creates a PHP session and sets a cookie. This means that Drupal is setting a PHP $_SESSION variable and checking to find out if a user is logged in. What I need to know is what the name of that variable is for standard user and for admin users so I can verify if the user is logged in when they visit my page. At this point I am open to any ideas..
Thanks,
Whit3fir3
Comments
Put the following in your page.tpl...
print '<pre style="background: #ffffff;">';print_r(get_defined_vars());print '</pre>';termporarily...you will see there are many variables available
e.g.
$is_admin
$logged_in
$user->uid
$user->name
etc etc
you should be able to use for what you want...
.
Check this:
http://drupal.org/node/799756#comment-2971050
The current logged-in user will be available in your script as $user.
if ($user->uid) { //If user id not zeroprint $user->uid;
print $user->name;
print_r($user->roles);
}
If all you care about is the user, and no other Drupal data, you could make the script lighter by using DRUPAL_BOOTSTRAP_SESSION instead of DRUPAL_BOOTSTRAP_FULL