Info
- 6 posts
- 3 voices
- Started 2 years ago by plop
- Latest reply from plop
- This topic is resolved
bbPress 1.0-alpha-6 : Favorites problem
-
- Posted 2 years ago #
Hi all,
I have a bbPress 1.0-alpha-6 running, and I don't know why the favorites link on a topic doesn't entirely work.When I click on the link "Add this topic to your favorites", it creates a meta on the database "bb_favorites" with the proper id, BUT, the link still shows "add this topic to your favorites" instead of a link to the favorite page.
AND, 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 :/Is it a known bug or is something wrong with my bbpress ..?
-
- Posted 2 years ago #
At this point, I would suggest upgrading to bbPress 1.0 and troubleshoot from there. No sense rehashing alpha bugs.
-
- Posted 2 years ago #
Ok thanks.
-
- Posted 2 years ago #
Flag this resolved plz.
Cleaning the house for V1 issues.
-
- Posted 2 years ago #
Done!
-
- Posted 2 years ago #
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->favoritesis 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 /> -
You must log in to post.