Hi all. I need to create a simil-gateway from Drupal to application X and from application X to Drupal. In other words I have an application (an ecommerce) and I want to interact in double-way (Drupal to ecomm and ecomm to Drupal) with it. For example: ecommerce's users are the drupal'user so I need to write an api (called from ecommerce) that get the user information, make login, make logout, etc etc.
I have tried to create and call (via browser, after a login in Drupal) a file like this:
<?php
include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
print_r($user);
?>
but the result is that the "uid" is 0. Why ?
Does anyone can give me some type of RTFM ?
M.
Quoting Davide Michel 'ZioBudda' Morelli michel@ziobudda.net:
<?php include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); print_r($user); ?>
but the result is that the "uid" is 0. Why ?
Uhm, you haven't pulled in the session or loaded the user variable.
Does anyone can give me some type of RTFM ?
http://api.drupal.org/api/5 http://api.drupal.org/api/function/user_load/5
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Earnie Boyd ha scritto:
Uhm, you haven't pulled in the session or loaded the user variable.
How "pulled in the session" ??? I do this:
mydomain/user/ (loggin into my account with my data) mydomain/mytestpage.php (and this say me that I'm the user "0", but it's not true.
http://api.drupal.org/api/5 http://api.drupal.org/api/function/user_load/5
I know user_load(), but when I'm logged into Drupal $user is avaible and I don't need to load my user-data.
M.
Quoting Davide Michel 'ZioBudda' Morelli michel@ziobudda.net:
Earnie Boyd ha scritto:
Uhm, you haven't pulled in the session or loaded the user variable.
How "pulled in the session" ??? I do this:
You might find some interesting information in $_SESSION[].
mydomain/user/ (loggin into my account with my data) mydomain/mytestpage.php (and this say me that I'm the user "0", but it's not true.
Well, the data isn't global to the external page. The globalness ends when the original page ends. You might want to check the drupal code for what happens for each node page.
http://api.drupal.org/api/5 http://api.drupal.org/api/function/user_load/5
I know user_load(), but when I'm logged into Drupal $user is avaible and I don't need to load my user-data.
Ok, sorry. I thought you were in an external page that you called bootstrap from. I guess I'm not sure what you are trying to do.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Earnie Boyd ha scritto:
Ok, sorry. I thought you were in an external page that you called bootstrap from. I guess I'm not sure what you are trying to do.
I need to create a "gateway" from Drupal to an e-commerce suite. For gateway I intend a number of functions that I can use into ecommerce suite that permit me to access to the Drupal data (and viceversa). For example: into ecommerce suite I want to know with which Drupal's user I'm logged-in (This steps: login in into Drupal site, go to ecomm suite and print $user content). I have thinked that the
include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
are enough for me but It's not true.
M.