Avoid a fatal error when adding a non-existent user to a site. props duck_. fixes #24460.

git-svn-id: https://develop.svn.wordpress.org/trunk@24509 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-06-25 14:24:18 +00:00
parent e49ffcfddd
commit 1cc916fb99

View File

@ -86,7 +86,7 @@ if ( $action ) {
$update = 'adduser';
$newuser = $_POST['newuser'];
$user = get_user_by( 'login', $newuser );
if ( $user->exists() ) {
if ( $user && $user->exists() ) {
if ( ! is_user_member_of_blog( $user->ID, $id ) )
add_user_to_blog( $id, $user->ID, $_POST['new_role'] );
else