wp_ajax_delete_comment [ WordPress Function ]
wp_ajax_delete_comment ( No parameters )
| Defined at: |
|
Soorgelijke functies: wp_ajax_delete_meta, wp_delete_comment, wp_ajax_edit_comment, wp_ajax_get_comments, wp_ajax_replyto_comment
No description yet.
Source
<?php
function wp_ajax_delete_comment() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
if ( !$comment = get_comment( $id ) )
wp_die( time() );
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
wp_die( -1 );
check_ajax_referer( "delete-comment_$id" );
$status = wp_get_comment_status( $comment->comment_ID );
$delta = -1;
if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
if ( 'trash' == $status )
wp_die( time() );
$r = wp_trash_comment( $comment->comment_ID );
} elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
if ( 'trash' != $status )
wp_die( time() );
$r = wp_untrash_comment( $comment->comment_ID );
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) // undo trash, not in trash
$delta = 1;
} elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
if ( 'spam' == $status )
wp_die( time() );
$r = wp_spam_comment( $comment->comment_ID );
} elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) {
if ( 'spam' != $status )
wp_die( time() );
$r = wp_unspam_comment( $comment->comment_ID );
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) // undo spam, not in spam
$delta = 1;
} elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) {
$r = wp_delete_comment( $comment->comment_ID );
} else {
wp_die( -1 );
}
if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
_wp_ajax_delete_comment_response( $comment->comment_ID, $delta );
wp_die( 0 );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- PHPXRef 0.7 : WordPress : Detail view of ajax-actions.php
wp_ajax_autocomplete_site() _wp_ajax_delete_comment_response() _wp_ajax_add_hierarchical_term() wp_ajax_delete_comment() wp_ajax_delete_tag() ...
phpxref.ftwr.co.uk - Docs for page ajax-actions.php
/wp-admin/includes/ajax-actions.php. Description. Description | ...
phpdoc.wordpress.org - wp_delete_comment (WordPress Function) - WPSeek.com
Similar Functions: wp_ajax_delete_comment, wp_filter_comment, wp_update_comment, wp_delete_attachment, wp_list_comments. Trashes or deletes a ...
wpseek.com - WordPress 3.4-beta1
Apr 5, 2012... was found for function _wp_ajax_add_hierarchical_term(). error, 384, No DocBlock was found for function wp_ajax_delete_comment() ...
docs.garyjones.co.uk