Forum Moderators: open
It works fine and welcomes my readers back fine back but when they go to post a comment it is posting it as anonymous which I think is caused by the form not fillin in the name, email and url fields from the cookie... (i've gotten it to welcome them back from the cookie but i don't know how to fill in the form.. and i wasn't able to find instructinos for that on the page that i found the code to begin with...) can anybody help.. below is the code that effected .. i need to fill that form in with information found from cookie.. how would i do that? thanks for any help!
<?php if ( get_option('comment_registration') &&!$user_ID ) :?>
<p>You must be <a href="<?php echo get_option('siteurl');?>/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">
<!-- Welcome Back Comment Code Start -->
<?php if( ''!== $comment_author ) {?>
<p>
<div id="welcomeback">
Welcome back <?php echo $comment_author;?> <span id="changewelcomeback"><span id="showinfo">(<a href="javascript: ShowUtils();">Change</a>)</span><span id="hideinfo" style="display:none;">(<a href="javascript: HideUtils();">Close</a>)</span></span><br>
Let us know what you're thinking...
</div>
<div id="authorinfo" style="display:none;"><?php }?>
<!-- Welcome Back Comment Code End -->
<?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="<?php _e('Log out of this account')?>">Logout »</a></p>
<?php else :?>
<fieldset>
<label for="author">Name<input type="text" name="author" class="commentInput" id="author" value="" size="12" tabindex="1" /></label>
<label for="email">Mail (will not be published)<input type="text" name="email" class="commentInput" id="email" value="" size="20" tabindex="2" /></label>
<label for="url">Website<input type="text" name="url" class="commentInput"id="url" value="" size="12" tabindex="3" /></label>
</fieldset>
<?php endif;?>
<?php if( ''!== $comment_author ) {?>
</div>
<?php }?>
<p><textarea name="comment" id="comment" cols="100%" rows="4" tabindex="4" class="maincommenttextbox"></textarea></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /><input type="hidden" name="comment_post_ID" value="<?php echo $id;?>" />
<?php show_subscription_checkbox();?>
<?php show_gravatar_signup();?>
</p></form><br>
<div><?php live_preview();?></div>
<?php endif; // If registration required and not logged in?>
<label for="url">Website<input type="text" name="url" class="commentInput"id="url" value="" size="12" tabindex="3" /></label>
Value will always be blank when specified as "". You need to populate value with whatever data you get from the cookie. If there's no value, it will still be blank, so you needn't worry about what will be there for visitors who have not yet sampled your baking (cookies.)
For textarea, it's between the tags
<textarea>here</textarea>
Note in the above example your label tag ends after the input field. That should end after the word "website", as "website" is the label for "url." Does not affect this issue, just a different one. :-)