Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there an easy way to see if a user - someone how has logged in in the past but is not currently logged in - is visiting my site?

I was thinking that checking if $COOKIE[TEST_COOKIE] is set, but I am uncertain.

  1. Is this a good method?
  2. Is there a better cookie to check for?
  3. What would you do?
share|improve this question
    
Hmmm ... TEST_COOKIE seems to disappear when session is over. Probably not a good idea. What do you think about checking to see if $COOKIE is not empty might be a better method as the wp-settings-time-* cookie seems to stick around for a year. –  mfields Jul 5 '11 at 13:11
    
Are you using $COOKIE or $_COOKIE? –  EAMann Jul 5 '11 at 15:30
    
Was doing it right in the code ... not sure where the underscore went? I've abandoned this though. –  mfields Jul 5 '11 at 16:41
add comment

1 Answer

You could check for this cookie wp-settings-1 it lasts for 1 day and then also check if wordpress_test_cookie is available. Or you could just write a simple plugin that checks if the user is logged in and adds a longer term cookie to check against.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.