Switch language

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




wp_update_comment [ WordPress Function ]

wp_update_comment ( $commentarr )
Parameters:
  • (array) $commentarr Contains information on the comment.
Uses:
Returns:
  • (int) Comment was updated if value is 1, or was not updated if value is 0.
Defined at:



Updates an existing comment in the database.

Filters the comment and makes sure certain fields are valid before updating.

Source


<?php
function wp_update_comment($commentarr) {
    global 
$wpdb;

    
// First, get all of the original fields
    
$comment get_comment($commentarr['comment_ID'], ARRAY_A);

    
// Escape data pulled from DB.
    
$comment esc_sql($comment);

    
$old_status $comment['comment_approved'];

    
// Merge old and new fields with new fields overwriting old ones.
    
$commentarr array_merge($comment$commentarr);

    
$commentarr wp_filter_comment$commentarr );

    
// Now extract the merged array.
    
extract(stripslashes_deep($commentarr), EXTR_SKIP);

    
$comment_content apply_filters('comment_save_pre'$comment_content);

    
$comment_date_gmt get_gmt_from_date($comment_date);

    if ( !isset(
$comment_approved) )
        
$comment_approved 1;
    else if ( 
'hold' == $comment_approved )
        
$comment_approved 0;
    else if ( 
'approve' == $comment_approved )
        
$comment_approved 1;

    
$data compact('comment_content''comment_author''comment_author_email''comment_approved''comment_karma''comment_author_url''comment_date''comment_date_gmt');
    
$rval $wpdb->update$wpdb->comments$datacompact'comment_ID' ) );

    
clean_comment_cache($comment_ID);
    
wp_update_comment_count($comment_post_ID);
    
do_action('edit_comment'$comment_ID);
    
$comment get_comment($comment_ID);
    
wp_transition_comment_status($comment->comment_approved$old_status$comment);
    return 
$rval;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



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