Skip to content

Commit

Permalink
Replaced existing comment form with the comment_form wordpress function.
Browse files Browse the repository at this point in the history
  • Loading branch information
tlongren committed Mar 1, 2011
1 parent d52d6bc commit 8e399ad
Showing 1 changed file with 10 additions and 95 deletions.
105 changes: 10 additions & 95 deletions comments.php
Expand Up @@ -92,103 +92,18 @@
<?php printf(__('You must <a href="%s">login</a> to post a comment.','unwakeable'), get_option('siteurl') . '/wp-login.php?redirect_to=' . htmlentities(urlencode(get_permalink()))); ?>
</p>
<?php else: ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

<?php
if ( isset($_GET['jal_edit_comments']) ):
$jal_comment = jal_edit_comment_init();

if ( ! $jal_comment ):
return;
endif;
comment_form( array(
'title_reply' => '',
'comment_notes_before' => '',
'comment_notes_after' => '',
'comment_field' => '<p><textarea id="comment" name="comment" cols="100%" rows="10" aria-required="true" tabindex="4"></textarea></p>',
'fields' => array(
'author' => '<div id="comment-author-info"><p><input type="text" name="author" id="author" value="'.esc_attr($comment_author).'" size="22" tabindex="1" /><label for="author"><strong>'._x('Name','unwakeable').'</strong></label></p>',
'email' => '<p><input type="text" name="email" id="email" value="'.esc_attr($comment_author_email).'" size="22" tabindex="2" /><label for="email"><strong>'._x('Mail','unwakeable').'</strong>'._x(' (will not be published)','unwakeable').'</label></p>',
'url' => '<p><input type="text" name="url" id="url" value="'.esc_attr($comment_author_url).'" size="22" tabindex="3" /><label for="url"><strong>'._x('Website','unwakeable').'</strong></label></p></div>')
) );
?>
<?php elseif ( $user_ID ): ?>

<p class="comment-login">
<?php printf( __('Logged in as %s.','unwakeable'), '<a href="' . get_option('siteurl') . '/wp-admin/profile.php">' . $user_identity . '</a>' ); ?> <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="<?php _e('Log out of this account','unwakeable'); ?>"><?php _e('Logout &raquo;','unwakeable'); ?></a>
</p>

<?php elseif ( '' != $comment_author ): ?>

<p class="comment-welcomeback"><?php printf(__('Welcome back <strong>%s</strong>','unwakeable'), $comment_author); ?>

<a href="javascript:toggleCommentAuthorInfo();" id="toggle-comment-author-info">
<?php _e('(Change)','unwakeable'); ?>
</a>

<script type="text/javascript" charset="utf-8">
//<![CDATA[
var changeMsg = "<?php echo esc_js( __('(Change)','unwakeable') ); ?>";
var closeMsg = "<?php echo esc_js( __('(Close)','unwakeable') ); ?>";

function toggleCommentAuthorInfo() {
jQuery('#comment-author-info').slideToggle('slow', function(){
if ( jQuery('#comment-author-info').css('display') == 'none' ) {
jQuery('#toggle-comment-author-info').text(changeMsg);
} else {
jQuery('#toggle-comment-author-info').text(closeMsg);
}
});
}

jQuery(document).ready(function(){
jQuery('#comment-author-info').hide();
});
//]]>
</script>
<?php endif; ?>

<?php if ( ! $user_ID ): ?>
<div id="comment-author-info">
<p>
<input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
<label for="author">
<strong><?php _e('Name','unwakeable'); ?></strong> <?php if ( $req ): _e('(required)','unwakeable'); endif; ?>
</label>
</p>

<p>
<input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
<label for="email">
<strong><?php _e('Mail','unwakeable'); ?></strong> (<?php _e('will not be published','unwakeable'); ?>) <?php if ( $req ): _e('(required)', 'unwakeable'); endif; ?>
</label>
</p>

<p>
<input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url">
<strong><?php _e('Website','unwakeable'); ?></strong>
</label>
</p>
</div><!-- comment-personaldetails -->
<?php endif; // If not logged in ?>

<!--<p><?php printf(__('<strong>XHTML:</strong> You can use these tags: %s','unwakeable'), allowed_tags()) ?></p>-->

<p>
<textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"><?php
if ( function_exists('jal_edit_comment_link') ):
jal_comment_content($jal_comment);
endif;

if ( function_exists('quoter_comment_server') ):
quoter_comment_server();
endif;
?></textarea>
</p>

<?php do_action('comment_form', $post->ID); ?>

<p>
<div><input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit','unwakeable'); ?>" /></div>

<?php if ( function_exists('comment_id_fields') ): comment_id_fields(); else: ?>
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<?php endif; ?>

</p>
</form>

<?php endif; // If registration required and not logged in ?>

<div class="clear"></div>
Expand Down

0 comments on commit 8e399ad

Please sign in to comment.