• Hello, I have a problem with getting my comments form to work.

    Every time the user (either logged in or not) tries to post a comment, it returns error “please fill out the name, email, comment” as if the fields were empty.

    I’m using comments.php file based on the Starkers theme – full code here: https://pastie.org/452097

    The code for the form itself looks like this:

    <?php if ('open' == $post->comment_status) : ?>
    
    <h3 id="respond">Leave a Reply</h3>
    
    <?php if ( get_option('comment_registration') &amp;&amp; !$user_ID ) : ?>
    <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_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">
        <fieldset>
    
        	<?php if ( $user_ID ) : ?>
    		<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out.</a></p>
    		<?php else : ?>
    
        	<label for="name">Name <?php if ($req) echo "<span>(Required)</span>"; ?></label>
        	<input type="text" name="name" id="name" value="<?php echo $comment_author; ?>" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    
        	<label for="mail">Mail <span>(will not be published) <?php if ($req) echo "(Required)"; ?></span></label>
        	<input type="text" name="mail" id="mail" value="<?php echo $comment_author_email; ?>" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />    	
    
        	<label for="site">Webiste</label>
        	<input type="text" name="site" id="site" value="<?php echo $comment_author_url; ?>" tabindex="3" />
    
        	<?php endif; ?>
    
    		<p><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></p>
    
        	<label for="comment-text">Comment</label>
        	<textarea name="comment-text" id="comment-text" cols="40" rows="10" tabindex="4"></textarea>
    
        	<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    		<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    		<?php do_action('comment_form', $post->ID); ?>
    
        </fieldset>
        </form>
    
    <?php endif; // If registration required and not logged in ?>
    
    <?php endif; ?>

    I would be grateful for some help, the project is very urgent so I need to find a solution asap. Thanks in advance!

    Justine

  • The topic ‘Comments: required fields bug?’ is closed to new replies.