Q:

How to link avatar and nickname to profile

On the single post page I want to link the avatar function to the author profile, but I tried 
<a href="<?php the_author_posts_link(); ?>">
<img src="<?php echo get_avatar($post->post_author, '64', $avatar); ?>">
</a>

but that doesn't work.
Also, how can I display the nickname (display name) and still link to the profile the following code gives a strange link and 404s
<a href="<?php echo get_author_posts_url(); ?>"><?php the_author_nickname(); ?></a>

some help would be greatly appreciated.
Thanks

A:

This a short compilation of the multiple comments above, so that future visitors don't have to read each and every one of them.
First of all, the_author_posts_link() is a deprecated function since version 2.1, so get_author_posts_url() or the_author_posts_url() should be used instead http://codex.wordpress.org/Function_Reference/get_author_posts_url
The the/get_author_posts_url() takes an argument that requires "ID of the author whose URL should be retrieved.", so the_author_posts_url( get_the_author_meta( 'ID' ) ) will work, and if you decide to use the get_author_post_url() instead of the_author_posts_url() don't forget to echo it out.

