I have just installed a fresh version of WP which I have turned in to a network install (using the instructions found here).

All seemed to be going well, and I was able to add a new site successfully, however I am experiencing issues with listing/adding users.

When I click on the Users menu item the list table gives the following warning –

Warning: array_keys() expects parameter 1 to be array, boolean given in {my-dir}\wp-admin\includes\class-wp-users-list-table.php on line 307

This line is – $editable_roles = array_keys( get_editable_roles() ); – the issue is that get_editable_roles() is ruturning false.

The same problem also occurs when I try to add a user, although the warning is at a different location –

Warning: array_reverse() expects parameter 1 to be array, boolean given in {my-dir}\wp-admin\includes\template.php on line 843

I’ve tried the obvious, deactivating all plugins (I’d added one) and switching to the default theme, but the warnings still remain.

Looking at get_editable_roles() I can see that the global $wp_roles->roles is empty, although $wp_roles->role_objects is correctly populated. From here, I don’t really know where to go next.

Can anybody please suggest how I may fix this problem?

1 Answer
1

In the DB, the wp_user_roles option in wp_options was empty. I copied the value from the same option in wp_2_options, as I had already added another blog.

Also, every user from the original blog (it was up and running before being changed to a network) had nothing listed against both the wp_capabilities and wp_user_level options in wp_usermeta. Because of this, the get_editable_roles() function was failing and in turn causing the errors listed above.

To fix this problem, for each user on the original blog, I copied the entries for the relevant user levels from the data stored under wp_2_capabilities and wp_2_user_level.

Leave a Reply

Your email address will not be published. Required fields are marked *