Want more features on Pastebin? Sign Up, it's FREE!
Guest

Cubepoints WPMU DB prefix correction

By: a guest on May 13th, 2010  |  syntax: None  |  size: 0.81 KB  |  views: 87  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function cp_getAllPoints($amt=0,$filter_users=array(),$start=0){
  2.         global $wpdb, $db_prefix;
  3.         if($amt>0){ $limit = ' LIMIT ' . $start.','.$amt; }
  4.         if (count($filter_users)>0){
  5.                 $extraquery = ' WHERE '.$db_prefix.'users.user_login != \'';
  6.                 $extraquery .= implode("' AND ".$db_prefix."users.user_login != '",$filter_users);
  7.                 $extraquery .= '\' ';
  8.         }
  9.         $array = $wpdb->get_results('SELECT '.$db_prefix.'users.id, '.$db_prefix.'users.user_login, '.$db_prefix.'users.display_name, '.$db_prefix.'usermeta.meta_value
  10.                 FROM `'.$db_prefix.'users`
  11.                 LEFT JOIN `'.$db_prefix.'usermeta` ON '.$db_prefix.'users.id = '.$db_prefix.'usermeta.user_id
  12.                 AND '.$db_prefix.'usermeta.meta_key=\''.POINTS.'\''.$extraquery.'
  13.                 ORDER BY '.$db_prefix.'usermeta.meta_value+0 DESC'
  14.                 . $limit . ';'
  15.                 ,ARRAY_A);
  16.         return $array;
  17.  
  18. }
clone this paste RAW Paste Data