Advertisement
Guest User

Cubepoints WPMU DB prefix correction

a guest
May 13th, 2010
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. insert this conditional block at top of file after the define and load_plugin lines ~line 20
  2.  
  3. if($wpdb->prefix == 'wp_1_'){
  4. $db_prefix = $wpmuBaseTablePrefix;
  5. }else {
  6. $db_prefix = $wpdb->prefix;
  7. }
  8.  
  9. copy and paste this block over existing one taking care to include last } before the next function begins
  10.  
  11. function cp_getAllPoints($amt=0,$filter_users=array(),$start=0){
  12. global $wpdb, $db_prefix;
  13. if($amt>0){ $limit = ' LIMIT ' . $start.','.$amt; }
  14. if (count($filter_users)>0){
  15. $extraquery = ' WHERE '.$db_prefix.'users.user_login != \'';
  16. $extraquery .= implode("' AND ".$db_prefix."users.user_login != '",$filter_users);
  17. $extraquery .= '\' ';
  18. }
  19. $array = $wpdb->get_results('SELECT '.$db_prefix.'users.id, '.$db_prefix.'users.user_login, '.$db_prefix.'users.display_name, '.$db_prefix.'usermeta.meta_value
  20. FROM `'.$db_prefix.'users`
  21. LEFT JOIN `'.$db_prefix.'usermeta` ON '.$db_prefix.'users.id = '.$db_prefix.'usermeta.user_id
  22. AND '.$db_prefix.'usermeta.meta_key=\''.POINTS.'\''.$extraquery.'
  23. ORDER BY '.$db_prefix.'usermeta.meta_value+0 DESC'
  24. . $limit . ';'
  25. ,ARRAY_A);
  26. return $array;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement