3

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
    Which plugin did you installed? I heard about some plugins be responsible of this error. Try to make the fresh install again without installing any plugin. – cybmeta Dec 30 '14 at 15:43
  • It was a custom plugin that creates a new post type and two new taxonomies (I wish to use this on multiple instances within the network, hence the need for a plugin rather than it being within a theme/child theme). No posts or terms had been created using them though, and sadly disabling it made no diference. Thanks. – David Gard Dec 31 '14 at 10:22
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.

| improve this answer | |
  • 1
    I have the same issue and can't figure out how to fix it. I have checked my wp_x_options tables and they have values set for wp_x_user_roles row. And my wp_usermeta table has a wp_capabilities row for most users. I need to dig deeper into the schema to see exactly how it fits together. – Tom May 8 '15 at 18:24
  • Trick for me was renaming the wp_user_roles to wp_x_user_roles - wordpress.stackexchange.com/questions/11725/… – benedict_w Jul 14 '15 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.