By WebRIPPER on
I want to get $user->uid (if authenticated user popped it up) from the
window, popped up by drupal site (not drupal window) *without*
transferring uid as parameter. Is it possible, and if it is, so how?
Thank you
I want to get $user->uid (if authenticated user popped it up) from the
window, popped up by drupal site (not drupal window) *without*
transferring uid as parameter. Is it possible, and if it is, so how?
Thank you
Comments
global $user; if ($user->uid
global $user;
if ($user->uid != 0) {
// Pop up
}
global $user is a constant that holds the current user information
No, from the popped up
No, from the popped up window
javascript:window.open('mywindow.php');
I want to get $user->uid in mywindow.php, not in oppener
not that i've tried it but......
i'd look at the contents of the index.php in your root drupal directory, check whats gets included/executed, maybe pop some derivative include of it into your page, probably the bootstrap.inc and work from that....
in fact ive just done a little test on a totally unrelated page, foo.php that i put in the root directory and this:
will pull out the user id so you can then work from that ie:
if($user->uid != 0) {.......etc etc
hth
tim
that works if you do
that works if you do this:
How to get the whole thing working
One thing to note, if you want the url paths to be correct, as in base_path(), path_to_theme() etc. make sure you set $base_url as well.
Here's a variation that I used to get a "free-standing" popup php script to work that includes the whole drupal environment
ie
I am getting warning and not user id
Hello,
I am having the same problem. But instead of popup, I have used the iframe in my drupal.
so supoose in my iframe I open say 'mypage.php', so in 'mypage.php' I want user id
I have tried the code but I am getting warning.
The warning I am getting is
Warning: ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time. in yoursite.com/drupal/sites/default/settings.php on line 134
Warning: ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time. in yoursite.com/drupal/sites/default/settings.php on line 136
Please help me out.