<?php do_action( 'bp_before_profile_loop_content' ); ?>

<?php if ( bp_has_profile() ) : ?>

	<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

		<?php if ( bp_profile_group_has_fields() ) : ?>

			<?php do_action( 'bp_before_profile_field_content' ); ?>

			<div class="bp-widget <?php bp_the_profile_group_slug(); ?>">

				<h4><?php bp_the_profile_group_name(); ?></h4>

				<table class="profile-fields">

					<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>

						<?php if ( bp_field_has_data() ) : ?>

							<tr<?php bp_field_css_class(); ?>>

								<td class="label"><?php bp_the_profile_field_name(); ?></td>

								<td class="data"><?php bp_the_profile_field_value(); ?></td>

							</tr>

						<?php endif; ?>

						<?php do_action( 'bp_profile_field_item' ); ?>

					<?php endwhile; ?>

				</table>
			</div>

			<?php do_action( 'bp_after_profile_field_content' ); ?>

		<?php endif; ?>

	<?php endwhile; ?>

	<?php do_action( 'bp_profile_field_buttons' ); ?>

<?php endif; ?>

<?php do_action( 'bp_after_profile_loop_content' ); ?>

<!--Begin Following-->
<?php global $bp, $current_user; get_currentuserinfo();

if($current_user->ID == $bp->displayed_user->id) {  ?>

	<div class="profile-box items-following">
	
		<h3><?php _e('Items You Follow', 'gp_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('You are not currently following any items.', 'gp_lang'); ?></strong>
				</div>
			
			<?php } ?>
		
		</div>
			
	</div>
			
<?php } ?>
<!--End Following-->