WordPress.org

Ready to get started?Download WordPress

Forums

WP Favorite Posts
[resolved] WP-Favorite Posts and BuddyPress (9 posts)

  1. mafaldam
    Member
    Posted 1 year ago #

    Hi!

    I'm using WP-Favorite Posts and BuddyPress in my WordPress site, and I'd like to show user's favorite posts (or at least only the post thumbnail, in a grid view if it's possible) in their BuddyPress profile.

    How can I do this?

    Thank you for helping!

    http://wordpress.org/extend/plugins/wp-favorite-posts/

  2. snipcrunch
    Member
    Posted 1 year ago #

    did you ever find a fix for this?

  3. neo-tronic
    Member
    Posted 8 months ago #

    Have you find a fix now? =)

  4. dnnsldr
    Member
    Posted 6 months ago #

    I am using a custom post type called 'Locations' where a user can favorite a location. This should get you started in the right direction. Just add your loop in between:

    <div class="favoritePlaces">
    				<h3>My Favorite Places</h3>
    				<?php
    					$favorite_post_ids = wpfp_get_users_favorites($GLOBALS['bp']->displayed_user->userdata->user_login); 
    
            				if($favorite_post_ids) { 
    
                    			foreach ($favorite_post_ids as $o) : $p = get_post($o); if ($p->post_status == 'publish') {
                        			$postID = get_post_meta( $post->ID);
    							//$locationID = get_post_meta( $post->ID, $postID);
    							//$locations = EM_Locations::get(array('location_id'=>$locationID));
    
    							$locationName = $postID[_location_name][0];
    							$locationCity = $postID[_location_town][0];
    							$locationState = $postID[_location_state][0];
    							$locationAddress = $postID[_location_address][0];
    							//$locationURL = $postID[guid][0];
    							$locationID = $postID[_location_id][0];
    
    							$favCount= $postID[wpfp_favorites][0];
    
    							$post_image_url = wp_get_attachment_image_src( $postID );
    							?>
    
    							<div class="feedItem places">
    
          						<div class="span5 feedImage placesColumns">
          							<a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail( $current_post, 'wpbs-featured-carousel' ); ?></a>
          						</div><!-- end of feedImage -->
          						<div class="span4 feedInfo">
          							<h3><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a><span class="heart-icon vanilla"><em class="count"><i class="icon-left fa fa-heart"></i><?php echo $favCount ?></em></span></h3>
          							<p class="description"><?php echo $postContent; ?></p>
    
          							<span class="info"><?php echo $locationAddress; ?><br /><?php echo $locationCity; ?>, <?php echo $locationState; ?></span>
          							<!--<a href="#" target="_blank">clubaron.com</a>-->
          							<ul class="feedLinks">
          								<li><a class="view-icon" href="<?php the_permalink(); ?>"><i class="icon-left fa fa-search"></i>View</a></li>
          								<?php if (current_user_can('member')) { ?>
          									<li><a href="<?php echo site_url(); ?>?wpfpaction=remove&postid=<?php echo $post->ID ?>" class="heart-icon wpfp-link"><i class="icon-left fa fa-heart"></i>Favorite</a></li>
          								<?php } ?>
          								<li><a class="share-icon popdiv bottom" rel="popdiv"
          									data-content="
          										<ul class='socialShare'>
          											<!-- facebook -->
          											<li><a class='facebook' href='http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>&t=A New Location from Nightvite' target='_blank' onclick='return fbs_click()'><i class='icon-left fa fa-facebook-square'></i></a></li>
          											<!-- twitter -->
          											<li><a class='twitter' href='http://twitter.com/intent/tweet?original_referer=<?php echo site_url() ?>&text=<?php echo urlencode(get_the_title()) ?>&url=<?php the_permalink() ?>' target='_blank' data-text='Check out this new Nightvite Location' data-count='none' data-hashtags='nightvite' data-url='<?php echo the_permalink(); ?>'><i class='icon-left fa fa-twitter-square'></i></a></li>
          											<!-- google plus -->
          											<li><a class='google' href='#' target='_blank'><i class='icon-left fa fa-google-plus-square'></i></a></li>
          											<!-- email -->
    												<li><a class='email' href='mailto:?subject=<?php gb_e('Nightvite has added a new location:') ?> <?php the_title(); ?>&body=<?php gb_e('Check this new Nightvite Location:') ?> <?php the_title(); ?>%0A<?php the_permalink(); ?>'><i class='icon-left fa fa-envelope'></i></a></li>
    
          										</ul>"><i class="icon-left fa fa-share"></i>Share</a>
          								</li>
          							</ul>
    
          						</div><!-- end of feeInfo -->
          					</div><!-- end of feedItem -->
    
                   			<?php } endforeach; ?>
    
           		 		<?php } else { ?>
    
                				<div class="profile-item">
                    				<strong>You currently have no favorite places. Why not <a href="<?php echo get_bloginfo('url'); ?>/places">favorite some places</a> now.</strong>
                				</div>
    
            				<?php } ?>
    			</div>
  5. Huseyin Berberoglu
    Member
    Plugin Author

    Posted 6 months ago #

    You can do this but needs some extra work.

    1- add a buddypress sub nav item to member profile page. see bp_core_new_subnav_item()

    2- in screen function of new subnav_item you can use wp favorite posts core functions and show displayed user's favorite posts to public.

    code tip;

    $fav_array = wpfp_get_users_favorites(bp_get_member_user_id());

    and post loop...

  6. Tim2376
    Member
    Posted 6 months ago #

    Hi,

    I would also like to get it so that when someone adds a post as their favorite it shows up on their buddypress profile.

    I think I understand most of your steps.

    However, can you explain how to post the loop?

    After you add...

    $fav_array = wpfp_get_users_favorites(bp_get_member_user_id());

    how do you post the loop to get it to show the posts?

  7. ivbscorp
    Member
    Posted 5 months ago #

    This is exactly what I need to do but I really don;t understand what you're saying. Can you tell me step by step, like go here, open this, replace this, etc. etc. I have same exact issue, only my custom post type is properties and I want them to view within BP.

  8. ivbscorp
    Member
    Posted 5 months ago #

    @Tim2376 I found a plugin that works with WP Favorite Posts and easily adds the user's favorites list to their profile menu. BuddyPress Custom Profile Menu
    http://wordpress.org/support/plugin/buddypress-custom-profile-menu
    You have to make sure you use [wp-favorite-posts] instead of {{wp-favorite-posts}}

  9. Tim2376
    Member
    Posted 5 months ago #

    thanks, yes that is how I ended up doing it as well. I just changed that plugin to allow public tab viewing on the profile page and then added a function to show the posts based on the buddypress user's profile instead of the logged in buddypress user. To do this you can use:

    $favorite_post_ids = wpfp_get_users_favorites($GLOBALS['bp']->displayed_user->userdata->user_login);

    to get the buddypress users favorites who's profile you are viewing. Then, you can add the code to display the favorites in the same function. After this, you can use a custom shortcode function to display it on the tab you created.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic