Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Show favourite count after each activity?


ousep
Participant

@ousep

@snark: I’ve modified the function to this:

function my_favorite_count() {
$my_fav_count = bp_activity_get_meta( bp_get_activity_id(), 'favorite_count' );
if ($my_fav_count >= 1) : {
if (is_user_logged_in()) : {
echo '<span>(' . $my_fav_count . ')</span>';
}
endif;
}
endif;
}
add_action( 'bp_activity_entry_meta', 'my_favorite_count' );

Apart from shortening my function name, this shows the count only if the visitor is logged in.

This code goes into bp-custom.php, and it outputs the count next to the Favorite or Remove Favorite button.

Skip to toolbar