Forums

$user_ID always null (4 posts)

  1. Tom Auger
    Member
    Posted 5 years ago #

    Hi folks! Quick question - in my comments.php template, we find the standard check to see whether comment_registration is required and the $user_ID global variable is defined.

    With the template I'm using, $user_ID always seems to be undefined, or I should say, the test always fails, thus users (even when logged in) never get to see the comment form.

    I guess I need to understand where is $user_ID defined? How does WP handle user authentication? In which of the 10 billion includes do we query the user, authenticate him, and pass his ID to this global variable?

    Thanks in advance for any insights you might have!

    Tom

  2. Tom Auger
    Member
    Posted 5 years ago #

    In this case, $user_ID is null because of a domain/cookie issue, best as I can tell. A quick trip to Admin-Options and setting both URLs to the same domain worked.

    Still would love to know which include does the initial query on get_currentuserinfo(); If anyone knows, please post your response! I will check back periodically.

  3. stilllive
    Member
    Posted 5 years ago #

    A quick trip to Admin-Options and setting both URLs to the same domain worked.

    Are there any methods of solving the problem without setting these URLs asame?

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    They don't have to be the same, but they do have to be the same *domain*.

Topic Closed

This topic has been closed to new replies.

About this Topic