[wp-hackers] Creating / Inserting into Table named after WP Username

Ryan McCue lists at rotorised.com
Sun Aug 25 01:42:07 UTC 2013


BenderisGreat wrote:
> This isnt working, I need to grab the active logged in user via Sql but I am
> unsure how. 

I'm not quite sure what you're trying to do here, but you can't get the
current user via SQL, it's set via cookies.

If you're doing this in a plugin/theme, then please don't use raw SQL
queries for this. The global $current_user contains all the data you'll
need, and if you need to store custom data for the user, please use user
meta instead of custom tables.

If you're doing this in some separate application, you need to load WP
in and use the authentication functions to get at the data.

More information would be helpful so that we know what you're trying to do.

-- 
Ryan McCue
<http://ryanmccue.info/>


More information about the wp-hackers mailing list