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: 1.13 KB  |  views: 427  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data