Support » How-To and Troubleshooting » Pre-filled comment form (keeping users signed in)

Pre-filled comment form (keeping users signed in)

  • I just switched from the default theme. On my new theme, I’m not automatically signed in and have to keep filling all the fields out. Annoying. I found this post but it didn’t really help me figure it out.

    I looked through comment.php on the default theme and think i’m getting close with this code:

    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be <a>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    <?php if ( $user_ID ) : ?>

    <p>Logged in as <a>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>

    <?php else : ?>

    can someone show me the right code and also tell me where to put it in my new comment.php?


Viewing 4 replies - 1 through 4 (of 4 total)
  • whooami



    you are past where you need to be.

    you need to make sure the cookie stuff is included in the theme you are using. its at the top of the default theme’s comments.php

    i would really appreciate some help from somebody. didn’t mean to anger you with the double thread, it was an honest mistake.

    both themes have the same cookie info at the top:

    if (!empty($post->post_password)) { // if there’s a password
    if ($_COOKIE[‘wp-postpass_’.$cookiehash] != $post->post_password) { // and it doesn’t match the cookie

    how can one be keeping users signed in and not the other?

    Any sort of input to this would be greatly appreciated. I have clients for whom the cookie function is not working on their comment forms…

    Your quickest option would to be to copy over the original comments theme page to your new one. Then format it from there.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pre-filled comment form (keeping users signed in)’ is closed to new replies.