Reply To: [Resolved] Show posts written by user on profile
The problem is most likely because you don’t have a loop-archive.php. What I did instead was change some of the code to suit what I had prior: an author.php file that was already styled the way I wanted.
In the plugin:
function profile_screen_posts_show() {
$theuser = bp_displayed_user_id();
query_posts("author=$theuser" );
if ( have_posts() ) :
get_template_part( 'loop', 'archive' );
else: ?>
<div id="message" class="info">
<p><?php _e( 'Sorry, this user has not published any posts.', 'buddypress' ); ?></p>
</div><?php endif; ?> <?php
}
I changed it to:
function profile_screen_posts_show() {
query_posts( 'author=' . bp_displayed_user_id() );
if ( have_posts() ) :
get_template_part( 'author' );
else: ?>
<div id="message" class="info">
<p><?php bp_displayed_user_username(); ?> has not published any articles or reviews. Want them to? Send a message or leave a wall post!</p>
</div>
<?php endif; ?> <?php
}
You’ll see in there: get_template_part( ‘author’ );
— change “author” to whichever template part you want to call. Most installs, I believe, will have an archive.php file, so use archive.