diff --git a/inc/avatars.php b/inc/avatars.php index 88769241e..78a9a44f4 100644 --- a/inc/avatars.php +++ b/inc/avatars.php @@ -40,13 +40,15 @@ function largo_has_gravatar( $email ) { */ function largo_has_avatar( $email ) { $user = get_user_by( 'email', $email ); - $result = largo_get_user_avatar_id( $user->ID ); - if ( ! empty ( $result ) ) { - return true; - } else { - if ( largo_has_gravatar( $email ) ) { + if ( ! empty( $user ) ) { + $result = largo_get_user_avatar_id( $user->ID ); + if ( ! empty ( $result ) ) { return true; - } + } else { + if ( largo_has_gravatar( $email ) ) { + return true; + } + } } return false; } diff --git a/inc/widgets/largo-author-bio.php b/inc/widgets/largo-author-bio.php index 5cac8bb51..013bfc328 100644 --- a/inc/widgets/largo-author-bio.php +++ b/inc/widgets/largo-author-bio.php @@ -48,8 +48,12 @@ function widget( $args, $instance ) { // make sure we have at least one bio before we show the widget foreach ( $authors as $key => $author ) { - $bio = trim( $author->description ); - if ( !is_author() && empty( $bio ) ) { + if ( is_object( $author ) && isset( $author->description ) ) { + $bio = trim( $author->description ); + } else { + $bio = ''; + } + if ( ! is_author() && empty( $bio ) ) { unset( $authors[$key] ); } else { $bios .= $bio;