From e5165308ec52750fada70cbdbc688c7edbc85eac Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 2 Oct 2019 14:15:17 +0700 Subject: [PATCH] Update --- inc/agency/class-opalestate-agency.php | 10 +++++++++- inc/property/class-opalestate-property.php | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/inc/agency/class-opalestate-agency.php b/inc/agency/class-opalestate-agency.php index 55150b02..64b32265 100755 --- a/inc/agency/class-opalestate-agency.php +++ b/inc/agency/class-opalestate-agency.php @@ -114,7 +114,15 @@ class OpalEstate_Agency { /** * Get url of user avatar by agency id */ - public static function get_avatar_url( $userID ) { + public static function get_avatar_url( $userID ) { + + $id = get_post_meta( $userID, OPALESTATE_AGENCY_PREFIX . 'avatar_id', true );; + $url = wp_get_attachment_image_url( $id, 'thumbnail' ); + + if( $url ) { + return $url; + } + return get_post_meta( $userID, OPALESTATE_AGENCY_PREFIX . 'avatar', true ); } diff --git a/inc/property/class-opalestate-property.php b/inc/property/class-opalestate-property.php index c6cdb8c8..09ba2235 100755 --- a/inc/property/class-opalestate-property.php +++ b/inc/property/class-opalestate-property.php @@ -467,8 +467,8 @@ class Opalestate_Property { $image_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'avatar_id', true ); $related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true ); - if ( $image_id ) { - $url = wp_get_attachment_url( $image_id ); + if ( $image_id ) { + $url = wp_get_attachment_image_url( $image_id, 'thumbnail' ); } else { $url = get_avatar_url( get_the_author_meta( 'email', $user_id ) ); }