Ticket #19791: patch.diff
File patch.diff, 2.3 KB (added by , 13 years ago) |
---|
-
wp-includes/capabilities.php
1112 1112 else 1113 1113 $caps[] = 'do_not_allow'; 1114 1114 break; 1115 case 'delete_user': 1116 case 'delete_users': 1117 // If multisite these caps are allowed only for super admins. 1118 if ( is_multisite() && !is_super_admin( $user_id ) ) { 1119 $caps[] = 'do_not_allow'; 1120 } else { 1121 if ( 'delete_user' == $cap ) 1122 $cap = 'delete_users'; 1123 $caps[] = $cap; 1124 } 1125 break; 1126 case 'create_users': 1127 if ( !is_multisite() ) 1128 $caps[] = $cap; 1129 elseif ( is_super_admin() || get_site_option( 'add_new_users' ) ) 1130 $caps[] = $cap; 1131 else 1132 $caps[] = 'do_not_allow'; 1133 break; 1115 1134 case 'edit_files': 1116 1135 case 'edit_plugins': 1117 1136 case 'edit_themes': 1118 1137 if ( defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT ) { 1119 1138 $caps[] = 'do_not_allow'; 1120 break; 1121 } 1122 // Fall through if not DISALLOW_FILE_EDIT. 1139 }else{ 1140 $caps[] = $cap; 1141 } 1142 break; 1123 1143 case 'update_plugins': 1124 1144 case 'delete_plugins': 1125 1145 case 'install_plugins': … … 1131 1151 // Files in uploads are excepted. 1132 1152 if ( defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS ) { 1133 1153 $caps[] = 'do_not_allow'; 1134 break; 1135 } 1136 // Fall through if not DISALLOW_FILE_MODS. 1154 }else{ 1155 $caps[] = $cap; 1156 } 1157 break; 1137 1158 case 'unfiltered_html': 1138 1159 // Disallow unfiltered_html for all users, even admins and super admins. 1139 1160 if ( defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML ) { 1140 1161 $caps[] = 'do_not_allow'; 1141 break; 1142 } 1143 // Fall through if not DISALLOW_UNFILTERED_HTML 1144 case 'delete_user': 1145 case 'delete_users': 1146 // If multisite these caps are allowed only for super admins. 1147 if ( is_multisite() && !is_super_admin( $user_id ) ) { 1148 $caps[] = 'do_not_allow'; 1149 } else { 1150 if ( 'delete_user' == $cap ) 1151 $cap = 'delete_users'; 1152 $caps[] = $cap; 1153 } 1154 break; 1155 case 'create_users': 1156 if ( !is_multisite() ) 1157 $caps[] = $cap; 1158 elseif ( is_super_admin() || get_site_option( 'add_new_users' ) ) 1159 $caps[] = $cap; 1160 else 1161 $caps[] = 'do_not_allow'; 1162 break; 1162 1163 }else{ 1164 $caps[] = $cap; 1165 } 1166 break; 1163 1167 default: 1164 1168 // Handle meta capabilities for custom post types. 1165 1169 $post_type_meta_caps = _post_type_meta_capabilities();