From a293bed116a80e5f52a7adf6c1769d27c56c2fc0 Mon Sep 17 00:00:00 2001 From: ThemeLexus Date: Thu, 3 Oct 2019 10:10:43 +0700 Subject: [PATCH] uapte --- inc/agency/class-opalestate-agency.php | 4 ++-- inc/agent/class-opalestate-agent.php | 9 +++++++-- templates/single-property/user/author-user-box.php | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/inc/agency/class-opalestate-agency.php b/inc/agency/class-opalestate-agency.php index 64b32265..bb73c90f 100755 --- a/inc/agency/class-opalestate-agency.php +++ b/inc/agency/class-opalestate-agency.php @@ -114,10 +114,10 @@ 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, $size='thumbnail' ) { $id = get_post_meta( $userID, OPALESTATE_AGENCY_PREFIX . 'avatar_id', true );; - $url = wp_get_attachment_image_url( $id, 'thumbnail' ); + $url = wp_get_attachment_image_url( $id, $size ); if( $url ) { return $url; diff --git a/inc/agent/class-opalestate-agent.php b/inc/agent/class-opalestate-agent.php index e86329b8..0bcaaa77 100755 --- a/inc/agent/class-opalestate-agent.php +++ b/inc/agent/class-opalestate-agent.php @@ -87,8 +87,13 @@ class OpalEstate_Agent { /** * Get url of user avatar by agent id */ - public static function get_avatar_url( $userID ) { - return get_post_meta( $userID, OPALESTATE_AGENT_PREFIX . "avatar", true ); + public static function get_avatar_url( $userID, $size='thumbnail' ) { + $id = get_post_meta( $userID, OPALESTATE_AGENT_PREFIX . 'avatar_id', true );; + $url = wp_get_attachment_image_url( $id, $size ); + + if( $url ) { + return $url; + } } /** diff --git a/templates/single-property/user/author-user-box.php b/templates/single-property/user/author-user-box.php index b26ea82c..e4030ef4 100755 --- a/templates/single-property/user/author-user-box.php +++ b/templates/single-property/user/author-user-box.php @@ -25,10 +25,10 @@ if ( $post->post_type == 'opalestate_agency' ) { $prefixs = OPALESTATE_AGENCY_PREFIX; - $picture = OpalEstate_Agency::get_avatar_url( $post->ID ); + $picture = OpalEstate_Agency::get_avatar_url( $post->ID , 'full' ); } else { $prefixs = OPALESTATE_AGENT_PREFIX; - $picture = OpalEstate_Agent::get_avatar_url( $post->ID ); + $picture = OpalEstate_Agent::get_avatar_url( $post->ID , 'full' ); } $trusted = get_post_meta( $related, $prefixs . 'trusted', true ); @@ -39,10 +39,10 @@ if ( $post->post_type == 'opalestate_agency' ) { $prefixs = OPALESTATE_AGENCY_PREFIX; - $picture = OpalEstate_Agency::get_avatar_url( $post->ID ); + $picture = OpalEstate_Agency::get_avatar_url( $post->ID , 'full' ); } else { $prefixs = OPALESTATE_AGENT_PREFIX; - $picture = OpalEstate_Agent::get_avatar_url( $post->ID ); + $picture = OpalEstate_Agent::get_avatar_url( $post->ID, 'full' ); } $trusted = get_post_meta( $related, $prefixs . 'trusted', true );