[development] $user->uid from popup

Farsheed tfarsheed at yahoo.com
Wed Jun 21 20:46:11 UTC 2006


Another way to do popups is to define a menu path such
as "/popup"

Then have the menu callback be a function that instead
of returning $output, prints and then exits.

function make_popup() {
$output = "Popup test";
print $output;
exit();
}

then you would have to provide the javascript in a
link, such as

<a href="/popup" onclick="window.open(...)">LAUNCH
POPUP WINDOW</a>

Then when a user clicks on the link, it would open up
a new window with javascript, and print out the data
inside the make_popup() function without having to go
through a theme_pager or anything. This way you can
avoid having to bootstrap (which I was told will cause
problems).

-F






--- Darrel O'Pry <dopry at thing.net> wrote:

> 
> 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.
> > >
> > >
> > 
> > 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the development mailing list