WordPress.org

Ready to get started?Download WordPress

Forums

Pre-filled comment form (keeping users signed in) (5 posts)

  1. superhotfemail
    Member
    Posted 7 years ago #

    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?

    Thanks

  2. whooami
    Member
    Posted 7 years ago #

    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

  3. superhotfemail
    Member
    Posted 7 years ago #

    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?

  4. Sekimori
    Member
    Posted 6 years ago #

    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...

  5. tgiokdi
    Member
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.