Question on Comments Posting Template
-
Might depend on what Theme you are using and if you are using any specific plugin(s).
Could start by looking to see if you have a comments.php in your Theme files–there you might find the form action.
Please see the comments PHP information and offer some assitance as I cannot find the form action in there…maybe staring at code too much!
Thanks!!!
<?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=”center”><?php _e(“This post is password protected. Enter the password to view comments.”); ?>
<?php return; } }
/* Function for seperating comments from track- and pingbacks. */
function k2_comment_type_detection($commenttxt = ‘Comment’, $trackbacktxt = ‘Trackback’, $pingbacktxt = ‘Pingback’) {
global $comment;
if (preg_match(‘|trackback|’, $comment->comment_type))
return $trackbacktxt;
elseif (preg_match(‘|pingback|’, $comment->comment_type))
return $pingbacktxt;
else
return $commenttxt;
}
?><script type=”text/javascript”>
// Used for showing and hiding user information in the comment form
function ShowUtils() {
document.getElementById(“authorinfo”).style.display = “”;
document.getElementById(“showinfo”).style.display = “none”;
document.getElementById(“hideinfo”).style.display = “”;
}function HideUtils() {
document.getElementById(“authorinfo”).style.display = “none”;
document.getElementById(“showinfo”).style.display = “”;
document.getElementById(“hideinfo”).style.display = “none”;
}
</script><!– You can start editing here. –>
<?php if (($comments) or (‘open’ == $post-> comment_status)) { ?>
<hr />
<div class=”comments”>
<div class=”second2″>
<h4><?php comments_number(‘No Responses’, ‘One Response’, ‘% Responses’ );?> to “<?php the_title(); ?>”</h4>
<div class=”metalinks”>
<span class=”metalink”><?php comments_rss_link(‘RSS’); ?></span>
<?php if (‘open’ == $post-> ping_status) { ?><span class=”metalink”>” title=”Copy this URI to trackback this entry.”>Trackback</span><?php } ?>
</div><?php if ($comments) { ?>
<ol class=”commentlist”>
<?php $count_pings = 1; foreach ($comments as $comment) {
if (k2_comment_type_detection() == “Comment”) { ?><li class=”<?php /* Style differently if comment author is blog author */ if ($comment->comment_author_email == get_the_author_email()) { echo ‘authorcomment’; } ?> item” id=”comment-<?php comment_ID() ?>”>
“>
<?php if (function_exists(‘gravatar’)) { ?><img src=”<?php gravatar(“X”, 32, “”); ?>” class=”gravatar” alt=”Gravatar Icon” /><?php } ?>
” class=”counter” title=”Permanent Link to this Comment”><? echo $count_pings; $count_pings++; ?>
<span class=”commentauthor” style=”font-weight: bold;”><?php comment_author_link() ?></span>
<small class=”commentmetadata”>on ” title=”<?php if (function_exists(‘time_since’)) { $comment_datetime = strtotime($comment->comment_date); echo time_since($comment_datetime) ?> ago<?php } else { ?>Permalink to Comment<?php } ?>”><?php comment_date(‘M jS, Y’) ?> at <?php comment_time() ?> <?php edit_comment_link(‘edit’,”,”); ?></small><div class=”itemtext”>
<?php comment_text() ?>
</div>
<?php if ($comment->comment_approved == ‘0’) : ?>
<p class=”alert”>Your comment is awaiting moderation.
<?php endif; ?><?php } } /* end for each comment */ ?>
<?php
$comments = $wpdb->get_results(“SELECT * FROM $wpdb->comments WHERE comment_post_ID = ‘$post->ID’ AND comment_approved = ‘1’ AND comment_type!= ” ORDER BY comment_date”);
?>
<?php
if ($comments) {
?>
<ol class=”pinglist”>
<?php $count_pings = 1; foreach ($comments as $comment) {
if (k2_comment_type_detection() != “Comment”) { ?>
<li class=”item” id=”comment-<?php comment_ID() ?>”>
“>
<?php if (function_exists(‘comment_favicon’)) { ?><span class=”favatar”><?php comment_favicon(); ?></span><?php } ?>
” title=”Permanent Link to this Comment” class=”counter”><? echo $count_pings; $count_pings++; ?>
<span class=”commentauthor”><?php comment_author_link() ?></span>
<small class=”commentmetadata”><span class=”pingtype”><?php comment_type(); ?></span> on ” title=”<?php if (function_exists(‘time_since’)) { $comment_datetime = strtotime($comment->comment_date); echo time_since($comment_datetime) ?> ago<?php } else { ?>Permalink to Comment<?php } ?>”><?php comment_date(‘M jS, Y’) ?> at <?php comment_time() ?> <?php edit_comment_link(‘edit’,”,”); ?></small><?php } } /* end for each comment */ ?>
<?php
if ($comments) {
?><?php }} ?>
<?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. –>
<p class=”center” style=”margin-top: 40px;”>Leave a comment<?php } else { // comments are closed ?>
<!– If comments are closed. –>
<?php if (is_single) { // To hide comments entirely on Pages without comments ?>
Comments are currently closed.
<?php } ?><?php } ?>
<?php } ?>
<?php if ($comments) { ?>
<?php include (TEMPLATEPATH . ‘/navigation.php’); ?>
<?php } ?></div> <!– Close Primary –>
<!– Reply Form –>
<?php if (‘open’ == $post-> comment_status) : ?>
<div class=”second2″>
<h4>Post your message here</h4><?php if ( get_option(‘comment_registration’) && !$user_ID ) : ?>
You must /wp-login.php?redirect_to=<?php the_permalink(); ?>”>log in 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 /wp-admin/profile.php”><?php echo $user_identity; ?>. /wp-login.php?action=logout” title=”<?php _e(‘Log out of this account’) ?>”>Logout »
<?php } elseif ($comment_author != “”) { ?>
<small>Welcome back <?php echo $comment_author; ?>
<span id=”showinfo”>(Change)</span>
<span id=”hideinfo” style=”display:none;”>(Close)</span></small><div id=”authorinfo”>
<input type=”text” name=”author” id=”author” value=”<?php echo $comment_author; ?>” size=”22″ tabindex=”1″ />
<label for=”author”><small>Name <?php if ($req) _e(‘(required)’); ?></small></label><input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”22″ tabindex=”2″ />
<label for=”email”><small>Mail (will not be published) <?php if ($req) _e(‘(required)’); ?></small></label><input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />
<label for=”url”><small>Website</small></label>
</div><?php } else { ?>
<input type=”text” name=”author” id=”author” value=”<?php echo $comment_author; ?>” size=”22″ tabindex=”1″ />
<label for=”author”><small>Name <?php if ($req) _e(‘(needed)’); ?></small></label><input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”22″ tabindex=”2″ />
<label for=”email”><small>Mail <?php if ($req) _e(‘(needed)’); ?></small></label><input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />
<label for=”url”><small>Website (optional)</small></label><?php } ?>
<!–<small>XHTML: You can use these tags: <?php echo allowed_tags(); ?></small>–>
<textarea name=”comment” id=”comment” cols=”100%” rows=”10″ tabindex=”4″></textarea>
<?php if (function_exists(‘show_subscription_checkbox’)) { ?><?php show_subscription_checkbox(); ?><?php } ?>
<input name=”submit” type=”submit” id=”submit” tabindex=”5″ value=”Submit” />
<input type=”hidden” name=”comment_post_ID” value=”<?php echo $id; ?>” />
<div class=”clear”></div><?php do_action(‘comment_form’, $post->ID); ?>
</form>
</div><!– Close Reply Form .Primary –>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div> <!– Close .comments container –>
<?php } ?>Please see the comments PHP information and offer some assitance as I cannot find the form action in there…maybe staring at code too much!
Thanks!!!
<?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=”center”><?php _e(“This post is password protected. Enter the password to view comments.”); ?>
<?php return; } }
/* Function for seperating comments from track- and pingbacks. */
function k2_comment_type_detection($commenttxt = ‘Comment’, $trackbacktxt = ‘Trackback’, $pingbacktxt = ‘Pingback’) {
global $comment;
if (preg_match(‘|trackback|’, $comment->comment_type))
return $trackbacktxt;
elseif (preg_match(‘|pingback|’, $comment->comment_type))
return $pingbacktxt;
else
return $commenttxt;
}
?><script type=”text/javascript”>
// Used for showing and hiding user information in the comment form
function ShowUtils() {
document.getElementById(“authorinfo”).style.display = “”;
document.getElementById(“showinfo”).style.display = “none”;
document.getElementById(“hideinfo”).style.display = “”;
}function HideUtils() {
document.getElementById(“authorinfo”).style.display = “none”;
document.getElementById(“showinfo”).style.display = “”;
document.getElementById(“hideinfo”).style.display = “none”;
}
</script><!– You can start editing here. –>
<?php if (($comments) or (‘open’ == $post-> comment_status)) { ?>
<hr />
<div class=”comments”>
<div class=”second2″>
<h4><?php comments_number(‘No Responses’, ‘One Response’, ‘% Responses’ );?> to “<?php the_title(); ?>”</h4>
<div class=”metalinks”>
<span class=”metalink”><?php comments_rss_link(‘RSS’); ?></span>
<?php if (‘open’ == $post-> ping_status) { ?><span class=”metalink”>” title=”Copy this URI to trackback this entry.”>Trackback</span><?php } ?>
</div><?php if ($comments) { ?>
<ol class=”commentlist”>
<?php $count_pings = 1; foreach ($comments as $comment) {
if (k2_comment_type_detection() == “Comment”) { ?><li class=”<?php /* Style differently if comment author is blog author */ if ($comment->comment_author_email == get_the_author_email()) { echo ‘authorcomment’; } ?> item” id=”comment-<?php comment_ID() ?>”>
“>
<?php if (function_exists(‘gravatar’)) { ?><img src=”<?php gravatar(“X”, 32, “”); ?>” class=”gravatar” alt=”Gravatar Icon” /><?php } ?>
” class=”counter” title=”Permanent Link to this Comment”><? echo $count_pings; $count_pings++; ?>
<span class=”commentauthor” style=”font-weight: bold;”><?php comment_author_link() ?></span>
<small class=”commentmetadata”>on ” title=”<?php if (function_exists(‘time_since’)) { $comment_datetime = strtotime($comment->comment_date); echo time_since($comment_datetime) ?> ago<?php } else { ?>Permalink to Comment<?php } ?>”><?php comment_date(‘M jS, Y’) ?> at <?php comment_time() ?> <?php edit_comment_link(‘edit’,”,”); ?></small><div class=”itemtext”>
<?php comment_text() ?>
</div>
<?php if ($comment->comment_approved == ‘0’) : ?>
<p class=”alert”>Your comment is awaiting moderation.
<?php endif; ?><?php } } /* end for each comment */ ?>
<?php
$comments = $wpdb->get_results(“SELECT * FROM $wpdb->comments WHERE comment_post_ID = ‘$post->ID’ AND comment_approved = ‘1’ AND comment_type!= ” ORDER BY comment_date”);
?>
<?php
if ($comments) {
?>
<ol class=”pinglist”>
<?php $count_pings = 1; foreach ($comments as $comment) {
if (k2_comment_type_detection() != “Comment”) { ?>
<li class=”item” id=”comment-<?php comment_ID() ?>”>
“>
<?php if (function_exists(‘comment_favicon’)) { ?><span class=”favatar”><?php comment_favicon(); ?></span><?php } ?>
” title=”Permanent Link to this Comment” class=”counter”><? echo $count_pings; $count_pings++; ?>
<span class=”commentauthor”><?php comment_author_link() ?></span>
<small class=”commentmetadata”><span class=”pingtype”><?php comment_type(); ?></span> on ” title=”<?php if (function_exists(‘time_since’)) { $comment_datetime = strtotime($comment->comment_date); echo time_since($comment_datetime) ?> ago<?php } else { ?>Permalink to Comment<?php } ?>”><?php comment_date(‘M jS, Y’) ?> at <?php comment_time() ?> <?php edit_comment_link(‘edit’,”,”); ?></small><?php } } /* end for each comment */ ?>
<?php
if ($comments) {
?><?php }} ?>
<?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. –>
<p class=”center” style=”margin-top: 40px;”>Leave a comment<?php } else { // comments are closed ?>
<!– If comments are closed. –>
<?php if (is_single) { // To hide comments entirely on Pages without comments ?>
Comments are currently closed.
<?php } ?><?php } ?>
<?php } ?>
<?php if ($comments) { ?>
<?php include (TEMPLATEPATH . ‘/navigation.php’); ?>
<?php } ?></div> <!– Close Primary –>
<!– Reply Form –>
<?php if (‘open’ == $post-> comment_status) : ?>
<div class=”second2″>
<h4>Post your message here</h4><?php if ( get_option(‘comment_registration’) && !$user_ID ) : ?>
You must /wp-login.php?redirect_to=<?php the_permalink(); ?>”>log in 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 /wp-admin/profile.php”><?php echo $user_identity; ?>. /wp-login.php?action=logout” title=”<?php _e(‘Log out of this account’) ?>”>Logout »
<?php } elseif ($comment_author != “”) { ?>
<small>Welcome back <?php echo $comment_author; ?>
<span id=”showinfo”>(Change)</span>
<span id=”hideinfo” style=”display:none;”>(Close)</span></small><div id=”authorinfo”>
<input type=”text” name=”author” id=”author” value=”<?php echo $comment_author; ?>” size=”22″ tabindex=”1″ />
<label for=”author”><small>Name <?php if ($req) _e(‘(required)’); ?></small></label><input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”22″ tabindex=”2″ />
<label for=”email”><small>Mail (will not be published) <?php if ($req) _e(‘(required)’); ?></small></label><input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />
<label for=”url”><small>Website</small></label>
</div><?php } else { ?>
<input type=”text” name=”author” id=”author” value=”<?php echo $comment_author; ?>” size=”22″ tabindex=”1″ />
<label for=”author”><small>Name <?php if ($req) _e(‘(needed)’); ?></small></label><input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”22″ tabindex=”2″ />
<label for=”email”><small>Mail <?php if ($req) _e(‘(needed)’); ?></small></label><input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />
<label for=”url”><small>Website (optional)</small></label><?php } ?>
<!–<small>XHTML: You can use these tags: <?php echo allowed_tags(); ?></small>–>
<textarea name=”comment” id=”comment” cols=”100%” rows=”10″ tabindex=”4″></textarea>
<?php if (function_exists(‘show_subscription_checkbox’)) { ?><?php show_subscription_checkbox(); ?><?php } ?>
<input name=”submit” type=”submit” id=”submit” tabindex=”5″ value=”Submit” />
<input type=”hidden” name=”comment_post_ID” value=”<?php echo $id; ?>” />
<div class=”clear”></div><?php do_action(‘comment_form’, $post->ID); ?>
</form>
</div><!– Close Reply Form .Primary –>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div> <!– Close .comments container –>
<?php } ?>
The topic ‘Question on Comments Posting Template’ is closed to new replies.
(@cooper)
20 years, 6 months ago
Hello,
I’m helping a friend and need some help on the posting template. Ok here it is:
This is what it says now:
Post your message here
(BOX) Name (required)
(BOX) Mail (will not be published) (required)
(BOX) Website
I want to change it like this:
(BOX) Name (required)
(BOX) Mail (**NO MESSAGE ABOUT IT NOT BEING PUBLISHED) (required)
(BOX) Website
and I want it to reference the email with posting, NOT the website which is where it is now. I cannot find where to edit ‘comment_form’, which is where I think I should edit the template….or I could be wrong, HELP!
THANKS!!!
David