How to Tweak Post Type for BuddyPress Favorites?

My theme is a business directory that has its own author profiling template. It lists businesses as a custom post type and has its own "Favorites" button that it bookmarks into an authors profile.

I am using BuddyPress in conjunction with this theme. And would like to override the theme's favorites functionality to instead bookmark it into buddypress favorites.

I found this link that explains how to do it

Here is the part of my theme's file that deals with the favorites part (this bookmarks favorites in its own system):

/* Add add to favourite html for directory theme on listings page  */
function directory_favourite_html($user_id,$post)
	global $current_user,$post;
	$add_to_favorite = __('Add to favorites',DIR_DOMAIN);
	$added = __('Added',DIR_DOMAIN);
		$add_to_favorite = icl_t(DIR_DOMAIN,'directory'.$add_to_favorite,$add_to_favorite);
		$added = icl_t(DIR_DOMAIN,'directory'.$added,$added);
	$post_id = $post->ID;
	$user_meta_data = get_user_meta($current_user->ID,'user_favourite_post',true);
	if($post->post_type !='post'){
		if($user_meta_data && in_array($post_id,$user_meta_data))
			<li id="tmplfavorite_<?php echo $post_id;?>" class="fav_<?php echo $post_id;?> fav"  > <a href="javascript:void(0);" class="removefromfav" onclick="javascript:addToFavourite('<?php echo $post_id;?>','remove');"><?php echo $added;?></a></li>
			<li id="tmplfavorite_<?php echo $post_id;?>" class="fav_<?php echo $post_id;?> fav"><a href="javascript:void(0);" class="addtofav"  onclick="javascript:addToFavourite('<?php echo $post_id;?>','add');"><?php echo $add_to_favorite;?></a></li>
		<?php }

How do I combine the below with the above:

//For single.php - put within the WP loop

global $bp;
$activity_id = bp_activity_get_activity_id( array(
'user_id' => $post->author_id,
'type' => 'new_blog_post',
'component' => 'blogs',
'item_id' => 1,
'secondary_item_id' => $post->ID
) );

<?php if ( is_user_logged_in() ) : ?>
<?php bp_has_activities();
if ( !my_bp_activity_is_favorite($activity_id) ) : ?>
<a>" class="fav" title="<?php _e( 'Mark as Favorite', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
<?php else : ?>
<a>" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Un-favorite', 'buddypress' ) ?></a>
<a>" style="font-size: 12px;">View Your Favorites</a>
<?php endif; ?>
<?php endif;?>