Closed ms-studio closed 6 years ago
Hey @ms-studio, this sure is weird. I've used this plugin on about 10 different projects, and have not run into this as an issue yet.
My guess, politely, is that it's a bug in your auto-populate code.
The built in wp_get_users_of_group()
function uses get_objects_in_term()
internally, so it will likely exhibit the same problem.
I'll leave this issue open for a bit, until we have confirmation one way or the other.
Hey @JJJ, thanks for the follow-up. It's very possible indeed that the issue was caused by my custom code.
Closing this. If it needs to be reopened, please feel free!
I noticed a weird thing occurring quite systematically with my user-groups:
On the edit-tags.php?taxonomy=user-group overview, the number stated for each group has one value more than the number of actual users displayed when navigating the group.
For instance, in the table view, one of my groups shows 13 users:
But when I go to the user listing, there are only 12 users in the group.
The reason for the mismatch: there's a "zero" included in the array of user IDs. If I do
get_objects_in_term()
for that group, here's what I see:Notice the zero in the first line! I'm not sure if there's a bug in my method of automatically populating the user-groups (very possible), or if the issue is in the plugin itself.
In my custom code, my workaround is to use
array_filter()
before displaying data related to the user-groups.