Re: bbPress 1.0-alpha-6 : Favorites problem
Ok just so you know, about the problem with the meta value :
” if I add another topic to my favs, it doesn’t add the id with the previous ones, but overrides the meta_value with the new one”, found the bug :
in the functions.bb-users.php , $user->favorites
is used instead of $user->bb_favorites
.
That solves the problem.
<br />
function bb_add_user_favorite( $user_id, $topic_id ) {<br />
global $bbdb;<br />
$user_id = (int) $user_id;<br />
$topic_id = (int) $topic_id;<br />
$user = bb_get_user( $user_id );<br />
$topic = get_topic( $topic_id );<br />
if ( !$user || !$topic )<br />
return false;</p>
<p> $fav = $user->bb_favorites ? explode(',', $user->bb_favorites) : array();<br />
if ( ! in_array( $topic_id, $fav ) ) {<br />
$fav[] = $topic_id;<br />
$fav = implode(',', $fav);<br />
bb_update_usermeta( $user->ID, $bbdb->prefix . 'favorites', $fav);<br />
}<br />
do_action('bb_add_user_favorite', $user_id, $topic_id);<br />
return true;<br />
}<br />