Users and user roles not shown in WordPress when Toolset Type-Access is active

Viewed 107

I just figured a strange behavior in the Toolset's Type-Access plugin. I think this si the same case as this unresolved issue. I my case, it's a multisite context, so users can exists in others sites, specially super-admins.

Logged as super-admin, when Type-Access is active, the user-list of a blog is empty, so is the role list when I want to add a new user.

Strangely, in cli (wp role list, wp user list) -mode, users and roles are well shown.

1 Answers

After many cache clear and transient deletion, I found the solution, diving in the code of Type-Access.

WordPress roles are filters via the editable_roles hook, which reliates to the UserListing::get_excluded_roles method. In shot, this method return the intersection of global roles and the current user's roles. But if the current user is superadmin and do not have explicit roles, this list is empty, and no roles nor users are displayed.

The solution is to manually add administrator role to any superadmin.

wp user set-role THE_USERNAME administrator [--url=thesiteurl]

Related