Wordpress User Comment Count



<?php
  function commentCount() {     global $wpdb;     $count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM '.$wpdb->comments.' WHERE comment_author_email = "'.get_comment_author_email().'"');     return $count;   }
?>

This is a work in progress. If you find this code to be useful in any way, please click here to donate.

Thanks!

- WMI

Grab ALL Keys from Memcache


<?php

  $m = new Memcache;
  $m->connect('localhost', 11211);
  
  $l = array();

  $s = $m->getExtendedStats('slabs');
  $i = $m->getExtendedStats('items');
  $s = call_user_func_array('array_merge', $s);
  $i = call_user_func_array('array_merge', $i);

  for ($p=1; $p<=(int)$s['active_slabs']; $p++) {
    $dump = $m->getExtendedStats('cachedump', $p, (int)$i['items'][$p]['number']);    
    
    foreach ($dump as $key) {
      $l[] = array_keys($key);
    }
            
  }

  $l = call_user_func_array('array_merge', $l);
  print_r($l);

?>

$l is the array that holds all the keys. Now just loop through it and use get and delete.