[wp-hackers] getting current user info

Mindshare Studios info at mindsharestudios.com
Thu Nov 8 20:17:45 GMT 2007


Hey thanks to all... I got it working like a charm. Another question, if I
may:

Does anyone know how to detect what template the current page uses?


--Damian

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Travis Snoozy
Sent: Thursday, November 08, 2007 11:57 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] getting current user info

On Thu, 8 Nov 2007 10:14:53 -0800, "Lloyd Budd"
<lloydomattic at gmail.com> wrote:

> On 11/8/07, Travis Snoozy <ai2097 at users.sourceforge.net> wrote:
> > On Thu, 8 Nov 2007 10:37:22 -0700, "Mindshare Studios"
> > <info at mindsharestudios.com> wrote:
> >
> >
> > > I could be barking up the wrong tree entirely. Any suggestions?
> >
> > You're thinking too hard. ;)
> >
> > global $current_user;
> > $current_user->user_email;
> >
> > Make sure you're doing it after authentication has taken place,
> > though.
> 
> I recently used just this and it is as easy as Andy and Travis suggest
> -- bummer is knowing what to look for, but I found similar code in
> another plugin (don't recall which one now).
> 
> http://codex.wordpress.org/Function_Reference/get_currentuserinfo

get_currentuserinfo is only needed if you're doing stuff really,
really early. When wp() is called, get_currentuserinfo is called
automatically; any filters/actions that are used after the wp action
just need to use the globals (it's been that way since 2.0). There are
only a tiny handful of actions that you can hook that *won't* have the
global data already set (most notably, plugins_loaded and init).


-- 
Travis 

In Series maintainer
Random coder & quality guy
<http://remstate.com/>
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list