Welp – been trying to get a DELETE COMMENT part working… I did, but there are a few caveats.
First, it takes you to the backend, to confirm. Once you confirm, it takes you to the backend list of comments… instead of the page from where you came.
Second, it breaks the AJAX for comments. YUK! I was OK with the backend redirect, because I set mine to only allow ADMINs to del/spam.
Third, I can’t get it to display WHERE I want… maybe you guys can figure out what I’m doing wrong.
Anyway, the code goes in functions.php…
Go down to the function prologue_comment_frontpage(…
Put this function above that function:
function delete_comment_link($id) { if (current_user_can('level_10')) {
echo '<a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&c=$id", 'delete-comment_' . $post->ID) . '">del</a> ';
echo '| <a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&dt=spam&c=$id") . '">spam</a>';
} }
Then add stuff to the prologue_comment_frontpage(..) function:
a variable:
deletespam_comment = delete_comment_link(get_comment_ID());
and the somewhere in the HTML area you would just call it:
$deletespam_comment
I must have altered mine too much because it is exactly that which breaks the AJAX.
Here’s the whole snippet (NOTE: I commented out them until I have time to figure it out!):
function delete_comment_link($id) { if (current_user_can('level_10')) { echo '<a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&c=$id", 'delete-comment_' . $post->ID) . '">del</a> ';
echo '| <a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&dt=spam&c=$id") . '">spam</a>';
}
}
function prologue_comment_frontpage( $comment, $args, $echocomment = true ) {
$GLOBALS['comment'] = $comment;
$depth = prologue_get_comment_depth( get_comment_ID() );
$comment_text = apply_filters( 'comment_text', $comment->comment_content );
$comment_class = comment_class( $class = '', $comment_id = null, $post_id = null, $echo = false );
$comment_time = get_comment_time();
$comment_date = get_comment_date();
$id = get_comment_ID();
$avatar = prologue_get_avatar( $comment->user_id, $comment->comment_author_email, 32 );
$author_link = get_comment_author_link();
$reply_link = prologue_get_comment_reply_link(
array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ', 'reply_text' => __('Reply', 'p2') ), $comment->comment_ID, $comment->comment_post_ID ); $can_edit = current_user_can( 'edit_post', $comment->comment_post_ID ); $edit_comment_url = get_edit_comment_link( $comment->comment_ID );
$edit_link = $can_edit? " | <a class='comment-edit-link' href='$edit_comment_url' title='".attribute_escape(__('Edit comment', 'p2'))."'>".__('Edit', 'p2')."</a>" : '';
//$deletespam_comment = delete_comment_link(get_comment_ID());
//$deletespam_comment = $can_edit? " | <a href='" . wp_nonce_url(/wp-admin/comment.php?action=cdc&c=$id) . "'>del</a> | <a href='" . wp_nonce_url(/wp-admin/comment.php?acti
on=cdc&dt=spam&c=$id) . "'>spam</a>" : '';
$content_class = $can_edit? 'commentcontent comment-edit' : 'commentcontent';
$awaiting_message = $comment->comment_approved == '0'? '<p><em>'.__('Your comment is awaiting moderation.', 'p2').'</em></p>' : '';
$permalink = clean_url( get_comment_link() );
$permalink_text = __('Permalink', 'p2');
$date_time = sprintf( __('%s <em>on</em> %s', 'p2'), get_comment_time(), get_comment_date() );
$html = <<<HTML
<li $comment_class id="comment-$id">
<div>
<div class="commenthead">
$author_link commented at: $date_time <!-- $deletespam_comment -->
</div>
<div style="margin: 5px; position: relative; float: left; ">
$avatar
</div>
<div class="$content_class" id="commentcontent-$id">
$comment_text
</div>
</div>
HTML;