Im currently encountering a problem i display user wp favorites posts fine, but the issue
is i wont display them, once users are logged out it says ” no posts have been made”
while each user has their own posts also once im logged in i can display my favorite posts in my profile but once i visit another profile it displays my favorite posts once again it should display the user’s favorite posts instead of mine i have tried bp_displayed_user_id();
but it doesn’t seem to do the job, not working at all
so i hope someone can solve my problem please…
here’s the code itself im using to display the favorite posts on the profiles
<div class="profile-box items-following">
<h3><?php _e('Items You Follow', 'bd_lang'); ?></h3>
<div class="profile-content">
<?php $favorite_post_ids = wpfp_get_users_favorites();
if($favorite_post_ids) { ?>
<?php foreach ($favorite_post_ids as $o) : $p = get_post($o); if ($p->post_status == 'publish') { ?>
<div class="profile-item">
<!--Begin Image-->
<?php if(has_post_thumbnail($o)) { ?>
<div class="post-thumbnail">
<a href="<?php get_permalink($o); ?>" title="<?php echo $p->post_title; ?>">
<?php $image = vt_resize(get_post_thumbnail_id($o), '', 50, 0, true); ?>
<img src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" alt="<?php if(get_post_meta(get_post_thumbnail_id($o), '_wp_attachment_image_alt', true)) { echo get_post_meta(get_post_thumbnail_id($o), '_wp_attachment_image_alt', true); } else { echo $p->post_title; } ?>" />
</a>
</div>
<?php } ?>
<!--End Image-->
<a href="<?php echo get_permalink($o); ?>" title="<?php echo $p->post_title; ?>"><?php echo $p->post_title; ?></a>
</div>
<?php } endforeach; ?>
<?php } else { ?>
<div class="profile-item">
<strong><?php _e('Your are not currently following any items.', 'bd_lang'); ?></strong>
</div>
<?php } ?>
</div>
</div>
As I understand the plugin (I took just a short glimpse, to be honest) you have to specify a user ID for the
wpfp_get_users_favorites()
function. Otherwise the currently logged-in user’s ID is taken.Here is everything in a single line:
wpfp_get_users_favorites($GLOBALS['bp']->displayed_user->userdata->user_login);