Warning: This function has been deprecated. Use current_user_can() instead.

user_can_edit_user() WordPress Function

The user_can_edit_user() function allows a user to edit another user. This is useful for when you need to give someone else access to your account, or if you need to change someone's password.

user_can_edit_user( int $user_id, int $other_user ) #

Can user can edit other user.


Description

Top ↑

See also


Top ↑

Parameters

$user_id

(int)(Required)

$other_user

(int)(Required)


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/deprecated.php

function user_can_edit_user($user_id, $other_user) {
	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );

	$user  = get_userdata($user_id);
	$other = get_userdata($other_user);
	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
		return true;
	else
		return false;
}


Top ↑

Changelog

Changelog
VersionDescription
2.0.0Use current_user_can()
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More