• Resolved Tom Auger

    (@tomauger)


    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]

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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…

    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.

    Thread Starter Tom Auger

    (@tomauger)

    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

    Thread Starter Tom Auger

    (@tomauger)

    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?

    Thread Starter Tom Auger

    (@tomauger)

    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

    Thread Starter Tom Auger

    (@tomauger)

    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 https://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: https://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.

    Thread Starter Tom Auger

    (@tomauger)

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

    Thread Starter Tom Auger

    (@tomauger)

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

    ….myself.

    modesty

    (@modesty)

    There has to be a better solution… I have a blog instaled at (let’s say) https://www.mydomain.com/myblog, but users see it as https://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?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Users cannot comment even after log-in’ is closed to new replies.