WordPress.org

Plugin Directory

Changeset 294390


Ignore:
Timestamp:
09/28/10 06:57:11 (4 years ago)
Author:
tellyworth
Message:

display user approved comment count in moderation screens if moderation is enabled

Location:
akismet/dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • akismet/dev/admin.php

    r294380 r294390  
    304304    if ( $desc ) 
    305305        echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' ) . '">'.htmlspecialchars($desc).'</a></span>'; 
     306         
     307    if ( get_option('comment_whitelist') || get_option('comment_moderation') ) { 
     308        $comment_count = akimset_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); 
     309        echo '<span class="akismet-user-comment-count" commentid="'.$comment->comment_ID.'" style="display:none;">'.sprintf( __( '%s approved' ), intval($comment_count) ).'</span>'; 
     310    } 
    306311     
    307312    return $a; 
  • akismet/dev/akismet.js

    r294380 r294390  
    44        jQuery(this).prependTo('#comment-' + thisId + ' #submitted-on'); 
    55    }); 
     6    jQuery('.akismet-user-comment-count').each(function () { 
     7        var thisId = jQuery(this).attr('commentid'); 
     8        jQuery(this).insertAfter('#comment-' + thisId + ' .author strong:first').show(); 
     9    }); 
    610}); 
  • akismet/dev/akismet.php

    r286630 r294390  
    240240} 
    241241 
     242// how many approved comments does this author have? 
     243function akimset_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) { 
     244    global $wpdb; 
     245     
     246    if ( !empty($user_id) ) 
     247        return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE user_id = %d AND comment_approved = 1", $user_id ) ); 
     248         
     249    if ( !empty($comment_author_email) ) 
     250        return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) ); 
     251         
     252    return 0; 
     253} 
     254 
    242255// log an event for a given comment, storing it in comment_meta 
    243256function akismet_update_comment_history( $comment_id, $message, $event=null ) { 
Note: See TracChangeset for help on using the changeset viewer.