Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Show favourite count after each activity?


ousep
Participant

@ousep

Hit a block here… how do I hook into the function where a user clicks on the favourite button, and make that do something to the database? Using bp_activity_action_mark_favorite? bp_activity_add_user_favorite?

Tried them both, with no results… I know I’m doing something wrong here, but my knowledge of PHP/mySQL is mostly trial and error… (a lot of the latter)

Right now, I’m doing this:

function my_favorite_by_add() {
$my_fav_by_current = bp_activity_get_meta( bp_get_activity_id(), 'favorite_by' );
global $current_user;
get_currentuserinfo();
$my_fav_by_new = $my_fav_by_current . ',' . $current_user->ID ;
bp_activity_update_meta( $activity_id, 'favorite_by', $my_fav_by_new );
}
add_action( 'bp_activity_add_user_favorite', 'my_favorite_by_add' );

Any suggestions?

Skip to toolbar