Title: users.php mods
Last modified: August 18, 2016

---

# users.php mods

 *  [eldeuce](https://wordpress.org/support/users/eldeuce/)
 * (@eldeuce)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/usersphp-mods/)
 * I was wondering if there is a way to add a check system to the users.php so that
   users are only allowed to edit users below their current level.
    So Admin can
   Edit anyone, Editors can only edit below Editor, not other Editors, etc.
 * I have put in a plugin that allows me to give Editors access to Add/Edit/Delete
   users, but unfortuantly it also gives Editors the ability to remove Admin.
 * Shouldn’t be too hard for someone who knows the core files to add a little bit
   of a check system.
 * Thanks in advance!

Viewing 1 replies (of 1 total)

 *  [Zoinks! Graphics](https://wordpress.org/support/users/zoinks/)
 * (@zoinks)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/usersphp-mods/#post-653704)
 * If there’s only one Admin (with userID #1) try this….
 * In /wp-admin/menu.php add this code at the top:
 *     ```
       $SuperAdmin = '';
   
       if($user_ID==1)
       	{ $SuperAdmin = 'Y'; }
       ```
   
 * Then you can use “if($SuperAdmin) { include only what SuperAdmin can do }” throughout
   the wp-admin files and menus.
 * For the /wp-admin/users.php limitation you requested, I just disable all display
   of Administrators by adding this code after <table class=”widefat”>:
 *     ```
       <?
       foreach($roleclasses as $role => $roleclass)
       	{
       	uksort($roleclass, "strnatcasecmp");
   
       	$NoShow = '';
   
       	if($wp_roles->role_names[$role]=='Administrator')
       		{ $NoShow = 'Y'; }
   
       	if(!$NoShow)
       		{
       		echo '<tbody><tr>';
   
       		if(!empty($role)) :
   
       			echo '<th colspan="7"><h3>' .
       			$wp_roles->role_names[$role] . $NoShow .
       			'</h3></th>';
   
       		else :
   
       			echo '<th colspan="7"><h3><em>' .
       			'No role for this blog</em></h3></th>';
   
       		endif;
   
       		echo '</tr><tr class="thead">' .
   
       			'<th>ID</th>' .
       			'<th>Username</th>' .
       			'<th>Name</th>' .
       			'<th>E-mail</th>' .
       			'<th>Website</th>' .
       			'<th colspan="2" style="text-align: center">Actions</th>' .
   
       		'</tr></tbody>' .
   
       		'<tbody id="role-' . $role . '">';
   
       		$style = '';
   
       		foreach((array) $roleclass as $user_object)
       			{
       			$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
       			echo user_row($user_object, $style);
       			}
   
       		echo '</tbody>';
       		}
       	}
   
       echo '</table>';
       ```
   
 * Hope this helps!

Viewing 1 replies (of 1 total)

The topic ‘users.php mods’ is closed to new replies.

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [editor](https://wordpress.org/support/topic-tag/editor/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Zoinks! Graphics](https://wordpress.org/support/users/zoinks/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/usersphp-mods/#post-653704)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
