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

@ -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 );
}

View File

@ -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 ) );
}