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

A hack so we can upgrade to WP 3.3.1

By: a guest on Jan 13th, 2012  |  syntax: PHP  |  size: 0.59 KB  |  views: 38  |  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 My_CalcUserLevel($user)
  2.         {
  3.                 global $wpdb;
  4.  
  5.                 if (is_multisite() && is_super_admin($user->ID))  return 11;
  6.  
  7.                 $maxlevel = 0;
  8.                 $levels = $wpdb->get_results($wpdb->prepare("SELECT meta_value FROM " . $wpdb->usermeta . " where user_id = %d and meta_key like '%%_user_level'", $user->ID));
  9.                 if ($levels)
  10.                 {
  11.                         foreach ($levels as $level)
  12.                         {
  13.                                 if ($maxlevel < (int)$level->meta_value)  $maxlevel = (int)$level->meta_value;
  14.                         }
  15.                 }
  16.  
  17.                 return $maxlevel;
  18.         }
  19.  
  20.         $user = wp_authenticate($username, $password);
  21.         if (!is_wp_error($user) && My_CalcUserLevel($user))
  22.         {
  23.                 ...
  24.         }
clone this paste RAW Paste Data