Changeset 44532

Show
Ignore:
Timestamp:
05/06/08 08:41:13 (2 months ago)
Author:
ear1grey
Message:

Cleaned up message describing what is about to be deleted.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • worst-offenders/trunk/functions.php

    r43791 r44532  
    251251function do_delete($comma_separated_id_list) { 
    252252      global $wpdb, $keys; 
    253       $query = "delete from wp_comments where   comment_ID in ($comma_separated_id_list)"; 
     253      $info["banned"] = wo3_prepare_ban_ip_addresses($comma_separated_id_list); 
     254      $query = "delete from wp_comments where comment_ID in ($comma_separated_id_list)"; 
    254255      $result = $wpdb->query($query); 
    255       return $result; 
     256      $info["deleted"] = $result; 
     257      return $info; 
     258} 
     259 
     260 
     261function wo3_prepare_ban_ip_addresses($comma_separated_id_list) { 
     262      global $wpdb, $keys, $wo3_feedback; 
     263      $query = "select distinct comment_author_IP from wp_comments where comment_ID in ($comma_separated_id_list)"; 
     264      $results = $wpdb->get_results($query); 
     265      $ban=0; 
     266      foreach($results as $result) { 
     267            do_action("ban_ip_address", $result->comment_author_IP); 
     268            $ban++; 
     269      } 
     270      return $ban;       
    256271} 
    257272 
     
    292307            if (!empty($_POST['worst'])) { 
    293308                  $deletionList     =     implode(",", $_POST['worst']); 
    294 //                $wo3_feedback[] = "<div class='updated'>$deletionList</div>"; 
    295                   $deleted = do_delete($deletionList); 
    296                   if ($deleted === false) { 
     309                  $info = do_delete($deletionList); 
     310                  if ($info["deleted"] === false)     { 
    297311                        $wo3_feedback[] = "<div class='updated'>DB      Error -     Failed to   delete - Boo!      Perhaps the DB   log   can   help!</div>"; 
    298312                  }     else { 
    299                         $wo3_feedback[] = "<div class='updated'>Congratulations!  You just ignored <strong>$deleted</strong> servings of spam!</div>"; 
     313                        $wo3_feedback[] = "<div class='updated'>Congratulations!  You just ignored <strong>".$info["deleted"]."</strong> servings of spam, from <strong>".$info["banned"]."</strong> worst offenders.</div>"; 
    300314                        update_option( $keys['counter'], $deleted + get_option( $keys['counter'] ) ); 
    301315                        reset_current_count();