Skip to content

Commit

Permalink
Merge pull request #1382 from INN/comment-errors
Browse files Browse the repository at this point in the history
Post Comment Errors
  • Loading branch information
benlk authored Dec 8, 2016
2 parents d27cf8b + cd748cc commit b60a4e5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
15 changes: 8 additions & 7 deletions inc/avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ function largo_has_gravatar( $email ) {
* @return bool true if an avatar is available for this user
* @since 0.4
*/
function largo_has_avatar($email) {
$user = get_user_by('email', $email);
$result = largo_get_user_avatar_id($user->ID);
if (!empty($result))
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))
} else {
if ( largo_has_gravatar( $email ) ) {
return true;
}
}
return false;
}
}
13 changes: 9 additions & 4 deletions inc/avatars/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ function largo_get_avatar_filter( $avatar, $id_or_email, $size, $default, $alt )
* @param int $string The size of the avatar
*/
function largo_get_avatar_src( $id_or_email, $size ) {
// get the user ID;
if ( ! is_numeric( $id_or_email ) ) {

// get the user ID
if ( is_numeric( $id_or_email ) ) {
$id = (int) $id_or_email;
} elseif ( is_object( $id_or_email ) ) {
if ( ! empty( $id_or_email->user_id ) ) {
$id = (int) $id_or_email->user_id;
}
} else {
$user = get_user_by( 'email', $id_or_email );
$id = $user->ID;
} else {
$id = (int) $id_or_email;
}

$avatar_id = largo_get_user_avatar_id( $id );
Expand Down

0 comments on commit b60a4e5

Please sign in to comment.