Considering WP hooks capabilities the only way to set extra content here is to reorganize reply/edit form itself, using hooks.
An example below demonstrates how to add extra HTML content on “reply” form. Find out “HERE IS YOUR CUSTOM CONTENT” label inside code to check where magic happens.
add_filter('wp_comment_reply', 'test_reply_comment_func', 10, 2);
function test_reply_comment_func($str, $input) {
extract($input);
$table_row = TRUE;
if ($mode == 'single') {
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
} else {
$wp_list_table = _get_list_table('WP_Comments_List_Table');
}
// Get editor string
ob_start();
$quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close');
wp_editor('', 'replycontent', array('media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings, 'tabindex' => 104));
$editorStr = ob_get_contents();
ob_end_clean();`
// Get nonce string
ob_start();
wp_nonce_field("replyto-comment", "_ajax_nonce-replyto-comment", false);
if (current_user_can("unfiltered_html"))
wp_nonce_field("unfiltered-html-comment", "_wp_unfiltered_html_comment", false);
$nonceStr = ob_get_contents();
ob_end_clean();
$content="<form method="get" action="">";
if ($table_row) :
$content .= '<table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="' . $wp_list_table->get_column_count() . '" class="colspanchange">';
else :
$content .= '<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">';
endif;
$content .= '<div id="replyhead" style="display:none;"><h5>Reply to Comment</h5>'
. '<p style="margin:10px 0;"> HERE IS YOUR CUSTOM CONTENT</p>'
. '</div>';
$content .= '<div id="addhead" style="display:none;"><h5>Add new Comment</h5></div>
<div id="edithead" style="display:none;">';
$content .= '
<div class="inside">
<label for="author">Name</label>
<input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
</div>
<div class="inside">
<label for="author-email">E-mail</label>
<input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
</div>
<div class="inside">
<label for="author-url">URL</label>
<input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
</div>
<div style="clear:both;"></div>';
$content .= '</div>';
// Add editor
$content .= "<div id='replycontainer'>\n";
$content .= $editorStr;
$content .= "</div>\n";
$content .= '
<p id="replysubmit" class="submit">
<a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106">Cancel</a>
<a href="#comments-form" class="save button-primary alignright" tabindex="104">
<span id="addbtn" style="display:none;">Add Comment</span>
<span id="savebtn" style="display:none;">Update Comment</span>
<span id="replybtn" style="display:none;">Submit Reply</span></a>
<img class="waiting" style="display:none;" src="' . esc_url(admin_url("images/wpspin_light.gif")) . '" alt="" />
<span class="error" style="display:none;"></span>
<br class="clear" />
</p>';
$content .= '
<input type="hidden" name="user_ID" id="user_ID" value="' . get_current_user_id() . '" />
<input type="hidden" name="action" id="action" value="" />
<input type="hidden" name="comment_ID" id="comment_ID" value="" />
<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
<input type="hidden" name="status" id="status" value="" />
<input type="hidden" name="position" id="position" value="' . $position . '" />
<input type="hidden" name="checkbox" id="checkbox" value="';
if ($checkbox)
$content .= '1';
else
$content .= '0';
$content .= "\" />\n";
$content .= '<input type="hidden" name="mode" id="mode" value="' . esc_attr($mode) . '" />';
$content .= $nonceStr;
$content .="\n";
if ($table_row) :
$content .= '</td></tr></tbody></table>';
else :
$content .= '</div></div>';
endif;
$content .= "\n</form>\n";
return $content;
}
Result
Exaplanation.
This code overrides the default reply form code. The reply comment and edit comment internally connected. When you trigger to “quick edit” the <div>
of .addhead
and .edithead
are visible, .replyhead
– hidden. When you trigger to “reply” .addhead
and .edithead
are hidden, .replyhead
– visible.