• Resolved jessica

    (@kerflop)


    I stylized my comments.php file (using the default theme as a base) for the first time so perhaps I’ve mussed something up. It appears that many can comment just fine, but others when they submit their perfectly valid email address etc, they get an error page that reads:

    Error: please enter a valid email address.

    You can try it out yourself with my e-mail: jessica (at) kerflop (dot) com at: http://kerflop.com/2008/01/21/new-layout-work-in-progress/#comments (my theme is still under construction)

    I’m guessing it might be accepting comments from those who are logged in – but not from those who aren’t. But I’m not sure how to rectify this in the code below without breaking the layout.

    And here is the code. Any thoughts?

    Thank you in advance.

    <?php // Do not delete these lines
    	if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Please do not load this page directly. Thanks!');
    
    	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
    			?>
    
    			<p class="nocomments">This post is password protected. Enter the password to view comments.
    
    			<?php
    			return;
    		}
    	}
    
    	/* This variable is for alternating comment background */
    	$oddcomment = 'class="alt" ';
    ?>
    
    <!-- You can start editing here. -->
    
    <?php if ($comments) : ?>
    	<div class="comments">
    			<ul>
    				<li><?php comments_number(__(''), __('1 Comment'), __('% Comments')); ?>
    				<?php if ( comments_open() ) : ?>
    					<a href="#postcomment" title="<?php _e("Leave a comment"); ?>"><img src="http://kerflop.com/wp-content/themes/chocolate_kerflop/images/ico-arrow.gif" alt="leave a comment" /></a>
    				<?php endif; ?>
    					<ul>
    					<?php foreach ($comments as $comment) : ?>
    						<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
    							<div class="comm-top"></div>
    							<?php if ($comment->comment_approved == '0') : ?>
    							<em>Your comment is awaiting moderation.</em>
    							<?php endif; ?>
    
    							<?php comment_text() ?>
    
    							<div class="time"><em><cite><?php comment_author_link() ?></cite> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('m-d-y') ?> at <?php the_time('g:i a'); ?></a></em></div>
    						<?php
    							/* Changes every other comment to a different class */
    							$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
    						?>
    
    						<?php endforeach; /* end for each comment */ ?>
    
    						</li>
    					</ul>
    				</li>
    			</ul>
    
    		</div>
    
    		<?php else : // this is displayed if there are no comments so far ?>
    
    					<?php if ('open' == $post->comment_status) : ?>
    					<!-- If comments are open, but there are no comments. -->
    
    					<?php else : // comments are closed ?>
    					<!-- If comments are closed. -->
    					<p class="spacer">Comments are closed.
    
    					<?php endif; ?>
    					<?php endif; ?>
    
    <?php if ('open' == $post->comment_status) : ?>
    
     <!--/comment-->
    		<div class="box4">
    			<div class="box4-top">
    				<h3>Leave a Comment</h3>
    			</div>
    			<div class="spcr">
    			<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    				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.
    
    				<?php else : ?>
    				<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    				<?php if ( $user_ID ) : ?>
    				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">Logout &raquo;</a>
    
    				<?php else : ?>
    					<fieldset id="commenting">
    					<div>
    						<label for="author">Name <?php if ($req) echo "<em>*</em>"; ?></label>
    						<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
    					</div>
    					<div>
    						<label for="author">E-Mail address: <?php if ($req) echo "<em>*</em>"; ?> <small>(never shown or shared)</small></label>
    						<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
    					</div>
    					<div>
    						<label for="author">Website URL: </label>
    						<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
    					</div>
    					<?php endif; ?>
    					<div>
    						<label>Your comment: <?php if ($req) echo "<em>*</em>"; ?></label>
    						<textarea name="comment" id="comment" cols="" rows="" tabindex="4"></textarea>
    					</div>
    					<div>
    						<input name="" type="image" src="http://kerflop.com/wp-content/themes/chocolate_kerflop/images/btn-submit.gif" value="Submit" class="btn"  style="border: 0px;" />
    						<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    					</div>
    					</fieldset>
    					<?php do_action('comment_form', $post->ID); ?>
    				</form>
    
    				<div id="ftime">
    					<h3>First Time Commenting?</h3>
    					<a href="http://kerflop.com/comment-policy/">Read the comment policy</a>
    						<em>*</em> indicates a required field
    
    				</div>
    				<!--/ftime-->
    				<div class="fix"></div>
    			</div>
    			<!--/spacer -->
    			<div class="box4-bot"></div>
    		</div>
    
    <?php endif; // If registration required and not logged in ?>
    <?php endif; // if you delete this the sky will fall on your head ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • you edited the values that are used for form submission — Look at the source of your comment submission form.

    <form action="http://kerflop.com/wp-comments-post.php" method="post" id="commentform">
    <fieldset id="commenting">
    		<div>
    
    			<label for="author">Name <em>*</em></label>
    			<input name="author" id="author" value="" size="22" tabindex="1" type="text">
    		</div>
    		<div>
    			<label for="author">E-Mail address: <em>*</em> <small>(never shown or shared)</small></label>
    			<input name="author" id="author" value="" size="22" tabindex="1" type="text">
    
    					</div>
    					<div>
    			<label for="author">Website URL: </label>
    			<input name="email" id="email" value="" size="22" tabindex="2" type="text">
    					</div>

    they’re currently all screwed up.

    here is what the fields look like in the default theme:

    <p><input name="author" id="author" value="" size="22" tabindex="1" type="text">
    
    <label for="author"><small>Name (required)</small></label></p>
    
    <p><input name="email" id="email" value="" size="22" tabindex="2" type="text">
    <label for="email"><small>Mail (will not be published) (required)</small></label></p>
    
    <p><input name="url" id="url" value="" size="22" tabindex="3" type="text">
    <label for="url"><small>Website</small></label></p>

    Note that

    the id’s are used to know what is being submitted inside the form – you cant arbitrarily change them as wordpress is looking for specific things.

    Thread Starter jessica

    (@kerflop)

    Der. I got this issue fixed. I swear, I slave and slave, driving myself insane, finally post to the forum, and then five minutes later figure it out.

    I had the labels and values mixed up in the form. People were typing their email address in what WordPress thought was the URL.

    Sigh.

    Thread Starter jessica

    (@kerflop)

    Oh Whooami, I missed your reply – yes I got it sorted, thanks so much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Random commenters receiving: Error: please enter a valid email address.’ is closed to new replies.