Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Denis Lam

    (@spiffyd)

    Specifically, I just want to call the avatar’s URL…

    <?php echo user_avatar_get_avatar(get_the_author_meta('ID')); ?> shows the image html. I just want the image path.

    Thread Starter Denis Lam

    (@spiffyd)

    I don’t know if there’s an easier way but in my functions.php I added this new function that seems to do the trick.

    function user_avatar_url( $item_id ) {
    
    	if( $avatar_img = user_avatar_avatar_exists( $item_id ) ):
    
    		$avatar_src = get_site_url()."/wp-content/uploads/avatars/".$item_id."/".$avatar_img;
    		if(function_exists('is_subdomain_install') && !is_subdomain_install())
    			$avatar_src = "/wp-content/uploads/avatars/".$item_id."/".$avatar_img;
    
    		$avatar_folder_dir = USER_AVATAR_UPLOAD_PATH."{$item_id}/";
    
    		$file_time = filemtime ($avatar_folder_dir."/".$avatar_img);
    
    		$avatar_url = $avatar_src;
    
    		return  $avatar_url ;
    	else:
    		return false;
    	endif;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How Do I Use PHP to Call the Custom Avatar?’ is closed to new replies.