[development] $user->uid from popup

Darrel O'Pry dopry at thing.net
Wed Jun 21 19:26:35 UTC 2006


If drupal is generating the pop-up content, or you bootstrap drupal in
your script the session will be available.

To do this with a minimal amount of drupal fuss you can use 
drupal_bootstrap in your foo.php.

I think you you add the following to the head of your foo.php you will
be set.
<?
include('common/bootstrap.inc');
drupal_bootstrap(DRUPAL_SESSION);
?>
http://api.drupal.org/api/4.7/function/drupal_bootstrap

cheers,
.darrel.

On Wed, 2006-06-21 at 21:47 +0300, Tamir Khason wrote:
> no, it does not
> do following
> make file (e.g. foo.php) and put it in drupal's root
> in the file put something like:
> <?php
> global $user;
> if($user->uid) {
> echo $user->uid;
> }
> else {
> echo "BOO";	
> }
> ?>
> comment post with following <a
> href="javascript:window.open('/foo.php');">foo</a>
> 
> Preview comment and click link. You'll get new window with BOO in it
> 
> 
> On 6/21/06, Darrel O'Pry <dopry at thing.net> wrote:
> > On Wed, 2006-06-21 at 01:29 +0300, Tamir Khason wrote:
> > > 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
> >
> >
> > If drupal is generating the popup gobal $user should be available if the
> > user is logged in. The session spans windows.
> >
> >
> 
> 



More information about the development mailing list