WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Users cannot comment even after log-in (10 posts)

  1. Tom Auger
    Member
    Posted 6 years ago #

    We have a new WP installation at separation.ca/blog.

    We have customized the skin slightly, but otherwise, the installation is pretty much virgin.

    When (unregistered) users see a new post, and they want to comment, they see "You must login to comment". Underneath that is the login hyperlink.

    Next, when they click the login hyperlink, they are taken to the login window. After correctly logging in, WP redirects back to the correct post.

    Here's where it gets weird. Even after successfully logging in (I've tried with Subscribers, Editors, even Admin) we still only see "You must login to comment" and the login link.

    When that link is clicked, it takes the (now logged in) user to their Edit Profile page. So obviously, WP knows that the user is logged in. But the page does not update to show the "Add Comment" link.

    How do I start to debug this problem? Could it be the theme? Is there a code snippet I can post here for a more experienced eye to look at and see if something's missing?

    Many thanks,

    Tom Auger [sig moderated]

  2. moshu
    Member
    Posted 6 years ago #

    You could simply remove that requirement for commenting (it's just an annoyance anyway), or you can try to switch to another theme (default or classic) and see if it works. If it does - your theme needs some rework...

  3. whooami
    Member
    Posted 6 years ago #

    yes, absolutely, the best way to start debugging that is to see what the default theme is doing.

    comments.php (the theme file) is a mess of if/then/else statements that control whats shown when, so if youve made any changes to that, there's a decent chance that something got mucked up. There's also an equally decent chance that the the theme author didnt understand what was needed and messed it all up up in the process.

    Its a difficult file to edit even for ppl that have looked at over and over and over again.

  4. Tom Auger
    Member
    Posted 6 years ago #

    Guys, thanks for the great tip - I should have thought of that before. I will look into it and post my success (or additional questions if unsuccessful) here.

    Regards,

    Tom

  5. Tom Auger
    Member
    Posted 6 years ago #

    Well, I have switched themes to the WP Default theme, and the behaviour is identical. I can conclude therefore that it is not the theme that is causing the issue.

    What else should I be looking for?

  6. Tom Auger
    Member
    Posted 6 years ago #

    Hmmm. I tried another theme and comments appeared to work correctly, so clearly the theme plays a role.

    Can someone point me to the right template file to be looking at? I've dissected comments.php and got hung up on the $user_ID variable which remains null under all circumstances. I don't think the problem is with comments.php.

    Also, how does this work? Do I need to bump this question so it gets attention again, or do I just hope some enterprising soul peruses the backlogs?

    As always, I greatly appreciate your input.

    Tom

  7. Tom Auger
    Member
    Posted 6 years ago #

    Tom, I have a solution for you:

    You're barking up the wrong tree altogether. It has to do (I believe) with how WP maintains session continuity: session cookies, is my educated guess.

    Your blog is hosted at http://www.separation.ca/blog, but you've given it a blog URL of blog.andrewfeldstein.com. Now, I'm not sure why the WP-admin allows you to do this, but apparently it breaks the session cookie, because it's a completely different domain. As you know, if your session cookie is set to work for a specific domain only (eg: http://www.separation.ca) it will not be read on another domain (blog.andrewfeldstein.com). And therefore, the comments.php page just doesn't realize you're logged in.

    The solution that works in this case is to go to wp-admin, logged in as Admin and change your site options so that the WP install URL is the same as the blog URL.

    I'm sure there's a better solution, otherwise why would they give you the option of having two different URLs in there, but in this case it works like a charm.

  8. Tom Auger
    Member
    Posted 6 years ago #

    Wow, thanks Tom for that great answer. And of course it worked. Just as you said it would.

  9. Tom Auger
    Member
    Posted 6 years ago #

    Hey man, no worries. Always glad to help....

    ....myself.

  10. Modesty
    Member
    Posted 6 years ago #

    There has to be a better solution... I have a blog instaled at (let's say) http://www.mydomain.com/myblog, but users see it as http://www.myblog.com and that's how I wanna keep it

    If they use IE they don't have the problem with comments, however in Firefox they are asked to login over and over again...

    Help anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic