user_can_edit_user

Can user can edit other user.

Description

user_can_edit_user( (int) $user_id, (int) $other_user ); 

Parameters (2)

0. $user_id (int)
The user id.
1. $other_user (int)
The other user.

Usage

  1. if ( !function_exists( 'user_can_edit_user' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // The other user. 
  8. $other_user = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = user_can_edit_user($user_id, $other_user); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function user_can_edit_user($user_id, $other_user) { 
  2. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  3.  
  4. $user = get_userdata($user_id); 
  5. $other = get_userdata($other_user); 
  6. if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) 
  7. return true; 
  8. else 
  9. return false;