143 posts
  • Has referred 1+ members
  • Has sold $100+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Has been part of the Envato Community for over 4 years
+3 more
vanRijswijk says

Hello all.

I am switching my API site dizcow.com to wordpress, now i want to use the wordpress login on a sub domain (custom made script). I downloaded a plug in (root Cookie) so the cookie is available on the entire domain.

When i readout the cookie on envato.dizcow.com its gives me this.

Array
(
    [wordpress_HASHED_CODE] => DizCow|1291636554|HASHED_CODE
    [wordpress_logged_in_HASHED_CODE] => DizCow|1291636554|HASHED_CODE
)

Can anybody tell/help me how i can check if this user is logged in.

I searched Google but i only tells me that i need to compare the HASHED _CODE with the password hash from the database table wp_users. But the HASHED _CODE and the password table are different codes.

Thanx for the help :)

143 posts
  • Has referred 1+ members
  • Has sold $100+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Has been part of the Envato Community for over 4 years
+3 more
vanRijswijk says

Never mind, i found the solution.

    require_once "path-to-wp/wp-config.php";

    $UID = wp_validate_auth_cookie();

    echo "USER ID: ".($UID ? $UID: "not logged");

When logged in $UID will echo the user_id of the user logged in, if not logged in it will return not logged.

by
by
by
by
by
by