Webfinger info: avoid PHP warning when user isn't defined
This should avoid warnings like this one: ``` PHP Warning: Attempt to read property "user_login" on bool in /var/www/html/wp-content/plugins/activitypub/includes/class-webfinger.php on line 27 ```
This commit is contained in:
parent
abef17b9ad
commit
643c47dcb7
1 changed files with 3 additions and 0 deletions
|
@ -23,6 +23,9 @@ class Webfinger {
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = \get_user_by( 'id', $user_id );
|
$user = \get_user_by( 'id', $user_id );
|
||||||
|
if ( ! $user ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
return $user->user_login . '@' . \wp_parse_url( \home_url(), \PHP_URL_HOST );
|
return $user->user_login . '@' . \wp_parse_url( \home_url(), \PHP_URL_HOST );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue