Hi,
Is there a way of getting a user's favorites to display without on a forum page other than /profile/#/favorite ?
I've looked at the code but I don't want to dig too deeply into it as I'm sure it will change a lot during the next year.
Basically what I want to do is create a unified profile page, which has been possible with everything except favorites.
See http://www.surrealroad.com/forum/1 if this doesn't make sense
get favorites list
(12 posts) (4 voices)-
Posted 2 years ago #
-
Has anyone figer this out?
Posted 1 month ago # -
Looking in "favourites.php", right in the root of BBpress (so its not hidden), i found this:
$topics = get_user_favorites( $user->ID, true );
I'd use that and output the array, but then again, i'd not have bumped 2 different 2 year old threads, let alone doing it before looking in the file cunningly named Favourites.php ;-)
Posted 1 month ago # -
Thanks, but how can i put this in my template?
Posted 1 month ago # -
Two ways:
1) It's an array, so just cycle through it and output the bits you want, this will allow you to style it as you please. If you're unsure of what it returns use: print_r($topics);
2) Alternatively, you could just copy all 3 lines from the Favourites.php file:
$topics = get_user_favorites( $user->ID, true );
$favorites_total = isset($user->favorites) ? count(explode(',', $user->favorites)) : 0;
bb_load_template( 'favorites.php', array('favorites_total') );This will output the favourites in the way you've described in your template folder.
==========================================
At the end of the day, BBpress has a number of issues, but if it can already do something, all you really need to do is copy and paste the code :)
Posted 1 month ago # -
Sorry, a bit of a PHP Noob, if I insert the following code in my template:
$topics = get_user_favorites( $user->ID, true );
$favorites_total = isset($user->favorites) ? count(explode(',', $user->favorites)) : 0;
bb_load_template( 'favorites.php', array('favorites_total') );I get an error
Posted 1 month ago # -
What error do you get mate?
Posted 1 month ago # -
Was that snippet of code wrapped in
<?php tags ?>?<?php $topics = get_user_favorites( $user->ID, true ); $favorites_total = isset($user->favorites) ? count(explode(',', $user->favorites)) : 0; bb_load_template( 'favorites.php', array('favorites_total') ); ?>Posted 1 month ago # -
Nope didn't work, i got the entire website loading serveral times in my sidebar where i put the following code:
<?php
$topics = get_user_favorites( $user->ID, true );
$favorites_total = isset($user->favorites) ? count(explode(',', $user->favorites)) : 0;
bb_load_template( 'favorites.php', array('favorites_total') );
?>Posted 1 month ago # -
What error do you get mate?
:)
Posted 1 month ago # -
Like i said, i got the entire website loading serveral times in my sidebar where i put the code.
Posted 1 month ago # -
The entire website?
So it's going in an infinte loop?Please, be less specific, don't post any code, oooh and don't include a screenshot. Guessing is a really worth while use of my time :)
Posted 1 month ago #
Reply
You must log in to post.