tricki
Forum Replies Created
-
Forum: Plugins
In reply to: [Groups] Getting users of group is inefficientAfter further research I found another problem I’m having: When a WP_User object is initialized the capabilities are loaded. This in turn causes the WP meta cache to load and cache all meta data of each user, one by one.
I created a pull request with two commits (I hope it’s in the correct branch..):
- Load all fields instead of just the ID and pass all data it to WP_User. This is what WP_User does internally as well.
- Add a method to pre-cache the user meta data in a single SQL statement
This solves my problem and 50 seconds load time just became 1.
It turns out my user actually is a “Super Admin” (which I understand to be the same as a “Network Admin”). I thought this role only existed with multisite installations so I never thought that was the problem..
Thanks a lot for your help. And thanks for the plugin.
Forum: Plugins
In reply to: [Groups] Getting users of group is inefficientHere you load the IDs of group members:
https://github.com/itthinx/groups/blob/master/lib/core/class-groups-group.php#L140
And in the Groups_User constructor you fire off a query to get the full user:
https://github.com/itthinx/groups/blob/master/lib/core/class-groups-user.php#L108
WP_User accepts an object in the constructor which doesn’t require a separate query for each user.