Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_ajax_dim_comment [ WordPress Function ]

wp_ajax_dim_comment ( No parameters )
Defined at:



No description yet.

Source


<?php
function wp_ajax_dim_comment() {
    
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;

    if ( !
$comment get_comment$id ) ) {
        
$x = new WP_Ajax_Response( array(
            
'what' => 'comment',
            
'id' => new WP_Error('invalid_comment'sprintf(__('Comment %d does not exist'), $id))
        ) );
        
$x->send();
    }

    if ( ! 
current_user_can'edit_comment'$comment->comment_ID ) && ! current_user_can'moderate_comments' ) )
        
wp_die( -);

    
$current wp_get_comment_status$comment->comment_ID );
    if ( 
$_POST['new'] == $current )
        
wp_dietime() );

    
check_ajax_referer"approve-comment_$id);
    if ( 
in_array$current, array( 'unapproved''spam' ) ) )
        
$result wp_set_comment_status$comment->comment_ID'approve'true );
    else
        
$result wp_set_comment_status$comment->comment_ID'hold'true );

    if ( 
is_wp_error($result) ) {
        
$x = new WP_Ajax_Response( array(
            
'what' => 'comment',
            
'id' => $result
        
) );
        
$x->send();
    }

    
// 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 );
    
wp_die);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics