I didn’t like the the plugin solution since it wasn’t quite what I wanted so I created my own. I wanted to be able to put a link to a user profile where ever I want by displaying the users name. You could hard code this if you know the users name but what if you want it to be dynamic and work for any user? I came up with this simple solution which is easy even if you don’t know php.
In the functions.php file add the following to the bottom.
function post_author_profile(){
/* Return authors profile link*/
echo( '<span class="author vcard"><a class="authorInfoLink" href= "'); echo home_url(); echo('/members/'); echo get_the_author(); echo('/profile/">'); echo get_the_author(); echo('</a></span>');
}
Then simply include the following php line of code any where in loop-index.php where you’d like the current posts users name displayed as a link linking to their profile. It knows what post it’s referring to based on each one it’s printed in as it goes through the loop. I’m using it in the following code in loop-index.php
<?php else : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div id="authorInfo">
<?php bp_post_author_avatar()?>
<p>
<?php post_author_profile()?><!-- HERE IT IS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
</div>
<div class="entry-meta">
<?php twentyten_posted_on(); ?>
</div><!-- .entry-meta -->
Live long and prosper.
-Elliot Robert