This commit is contained in:
Hoang Huu 2019-10-02 14:15:17 +07:00
parent ca848a3844
commit e5165308ec
2 changed files with 11 additions and 3 deletions

View File

@ -115,6 +115,14 @@ class OpalEstate_Agency {
* Get url of user avatar by agency id * 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 ); return get_post_meta( $userID, OPALESTATE_AGENCY_PREFIX . 'avatar', true );
} }

View File

@ -468,7 +468,7 @@ class Opalestate_Property {
$related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true ); $related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
if ( $image_id ) { if ( $image_id ) {
$url = wp_get_attachment_url( $image_id ); $url = wp_get_attachment_image_url( $image_id, 'thumbnail' );
} else { } else {
$url = get_avatar_url( get_the_author_meta( 'email', $user_id ) ); $url = get_avatar_url( get_the_author_meta( 'email', $user_id ) );
} }