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 5 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 5 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by