WordPress.org

Ready to get started?Download WordPress

Forums

User Photo
Plugin management screen times out when site has > ~ 7000 users (2 posts)

  1. plugins_lexblog
    Member
    Posted 1 year ago #

    Hi,

    Great plugin, thanks so much.

    One issue. On a wpmu site with over 7k users, the plugin management screen times out with a fatal error due to the block near line 777 (ymmv, as we have hacked a few snippets of this plugin). Regardless, you're looping through every single user in the db which is not realistic for us.

    http://wordpress.org/extend/plugins/user-photo/

  2. jondaley
    Member
    Posted 1 year ago #

    I'm seeing this too, though I have 33K users, it isn't timing out (I have the script timeout set really high), but the page takes forever (90 seconds?) to load.

    If you replace the for loop with this:

    global $wpdb;
    $users = $wpdb->get_results("SELECT u.ID, u.user_login FROM ".$wpdb->prefix."users u,".
      $wpdb->prefix."usermeta um WHERE u.ID = um.user_id ".
      "AND um.meta_key = 'capabilities' ".
      "AND um.meta_value LIKE '%administrator%' ORDER BY u.user_login");
    
    foreach($users as $user){
      print "<option value='" . $user->ID . "'";
      if($userphoto_admin_notified == $user->ID)
        print " selected='selected'";
      print ">" . $user->user_login . "</option>";
    }

    It will go a lot faster.

    I don't know if WP has a function that does this for you - seems like it should, but I couldn't find it.

    (Note, my code is for a non-WPMU site, I don't know if the query has to be fancier to be MU compatible...)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.