140 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • Referred between 1 and 9 users
  • Bought between 100 and 499 items
  • Netherlands
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 :)

140 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • Referred between 1 and 9 users
  • Bought between 100 and 499 items
  • Netherlands
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