• Resolved David Gard

    (@duck_boy)


    About two weeks ago I changed my WP install to a network site, but ever since I’ve been plagued with issues in the admin area.

    While I have been able to figure most of it out, one issue is still defeating me. While this post lists 2x errors (as below), they are actually caused by the same single issue.

    Error 1 –

    On the Users page (anyblog/wp-admin/users.php) I’m shown the following error –

    Warning: array_keys() expects parameter 1 to be array, boolean given

    Error 2 –

    On the Edit User page I’m shown the following error –

    Warning: array_reverse() expects parameter 1 to be array, boolean given

    Why the errors are occuring –

    Bothe of these errors are caused by get_editable_roles() returning false, as opposed to an array of roles like it is supposed to.

    Tracing that function back I can see it looks like this –

    function get_editable_roles() {
    	global $wp_roles;
    
    	$all_roles = $wp_roles->roles;
    
    	$editable_roles = apply_filters( 'editable_roles', $all_roles );
    
    	return $editable_roles;
    }

    When I check the contents of the global $wp_roles I see that $wp_roles->roles is empty, whereas the rest of the object is populatd correctly.

    The trouble is, because $wp_roles is a global there is a dissconnect and I have no idea where it is actually created/populated, meaning I’m a bit stuck for ideas with regards to tracing the error further.

    Any hints or tips (or the answer, if you know it!) would be apprciated.

    Thanks,
    David

    P.s. For the sack of full disclosure, this question is also on the WordPress Stack Exchange site, although it is unanswered.

    https://wordpress.stackexchange.com/questions/173580/network-installation-giving-errors-when-viewing-or-adding-a-user

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    So have you done the needful and disabled ALL plugins on the site and changed the theme of the main domain to a default theme?

    Thread Starter David Gard

    (@duck_boy)

    I certainly have, that made no difference though.

    But… I believe I have literally just now found and fixed problem.

    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

    Fingers crossed it’s all working fine now!

    Thanks for your reply any way ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    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.

    That would do it. I would make a backup of your DB and go over ALL your plugins on the main site, because that shouldn’t ever be deleted!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Network admin throwing error when I try to add/edit a user’ is closed to new replies.