Trying my luck once more with more smarter and awesome peeps =D
In my last question the issue was regarding getting wordpress user ID, which worked perfectly after someone steered me in the right direction.
Now I'm trying to help my friend achieve this with the same code but she doesn't get the user id no matter what we try.
The php code
require ('../wp-blog-header.php');
global $current_user;
get_currentuserinfo();
$printID = $current_user->ID;
echo $printID;
This gives me the ID of the user who is logged in.
I tried using the same code on her site, she's got a subfolder but that should be fine right?
require ('../Wordpress/wp-blog-header.php');
global $current_user;
get_currentuserinfo();
$printID = $current_user->ID;
echo $printID;
This prints out "0", doesn't matter which user that is logged in, still zero :(
Anyone got some tips? :D
print_r( wp_get_current_user() )
or simplyvar_dump( is_user_logged_in() _
? About the sub-folder, that should be the correct path since you didn't get any errors..require ('../wp-blog-header.php');
with both of those strings but it just crashed with a 500 error :(print_r( wp_get_current_user() ); var_dump( is_user_logged_in() );
little syntax errors I made. Hope you're working on a local installation or you have control over your server.WP_User Object ( [data] => stdClass Object ( [ID] => 2 [user_login] => gruffmeister[user_fname]
Her output:WP_User Object ( [data] => stdClass Object ( ) [ID] => 0 [caps] => Array ( ) [cap_key] => [roles] => Array ( ) [allcaps] => Array ( ) [filter] => )
Your right, it doesn't see that I'm logged in. Cookie trouble because of the subdirectory or some login issues maybe? :S