Skip to:
Content
Pages
Categories
Search
Top
Bottom

get favorites list

  • @jaxxx

    Member

    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

Viewing 11 replies - 1 through 11 (of 11 total)
  • @56alifar

    Blocked

    Has anyone figer this out?

    @kevinjohngallagher

    Member

    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 ;-)

    @56alifar

    Blocked

    Thanks, but how can i put this in my template?

    @kevinjohngallagher

    Member

    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 :)

    @56alifar

    Blocked

    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

    @kevinjohngallagher

    Member

    What error do you get mate?

    @chrishajer

    Participant

    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') );
    ?>

    @56alifar

    Blocked

    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') );

    ?>

    @kevinjohngallagher

    Member

    What error do you get mate?

    :)

    @56alifar

    Blocked

    Like i said, i got the entire website loading serveral times in my sidebar where i put the code.

    @kevinjohngallagher

    Member

    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 :)

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Skip to toolbar