2

I am new to drupal and I want to see the logged in user name and his email address in a phpscript which is not in drupal installation. Any idea how would I go about it. Using drupal 6.2

tried this already

<?php
require_once 'includes/bootstrap.inc';
require_once 'includes/common.inc';
require_once 'includes/module.inc';

global $user; 
if ($user->uid) 
{ 
$name=$user->name; 
echo $name; 
}

?>

Thanks

Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221

1 Answers1

4

The best way to do this is hook your standalone script into Drupal's bootstrapping mechanism. Here's a SO question that shows how to do that.

Then, your global $user solution will work.

Community
  • 1
  • 1
EMI
  • 816
  • 5
  • 9