Has anyone figer this out?
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
Thanks, but how can i put this in my template?
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
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
What error do you get mate?
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') );
?>
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') );
?>
Like i said, i got the entire website loading serveral times in my sidebar where i put the code.
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