Created
April 2, 2013 10:16
-
-
Save mkdizajn/5291247 to your computer and use it in GitHub Desktop.
How to Allow Administrators to Edit Users in a WordPress Network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* wordpress multisite how to allow administrators to edit users! */ | |
function mc_admin_users_caps( $caps, $cap, $user_id, $args ){ | |
foreach( $caps as $key => $capability ){ | |
if( $capability != 'do_not_allow' ) | |
continue; | |
switch( $cap ) { | |
case 'edit_user': | |
case 'edit_users': | |
$caps[$key] = 'edit_users'; | |
break; | |
case 'delete_user': | |
case 'delete_users': | |
$caps[$key] = 'delete_users'; | |
break; | |
case 'create_users': | |
$caps[$key] = $cap; | |
break; | |
} | |
} | |
return $caps; | |
} | |
add_filter( 'map_meta_cap', 'mc_admin_users_caps', 10, 4 ); | |
?> |
You can create a file in /wp-content/mu-plugins and paste the code above.
Great - I was looking for this. This is very helpful - thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, Thanks for this, is this to be added to capabilities.php or in a separate file? I have found similar code to this just no instructions as to where it goes.