Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Comment Errors #1382

Merged
merged 2 commits into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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