Skip to:
Content
Pages
Categories
Search
Top
Bottom

Count topic’s favorites


  • Loc Pham
    Participant

    @phamdacloc

    I’m using bbPress’s “favorite” feature as “like” feature in other social networks in my application. Is there a function which would allow me to count the number of users whom “favorited” a topic? I’m also interested in counting the number of subscribed users for a particular topic as well. I’ve looked into /bbpress/includes/topics/templates.php but did not find any and wondering if you’re aware of any.

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)

  • Robkk
    Moderator

    @robkk

    The favorited/subscribed data is stored in the user meta table specific to each user, I am not sure how to do this too or even if it is possible.

    @Loc Pham,

    You will need some coding for this, so probably a developer can help you. But to give you some starting points:
    – As @Robkk says, this is stored in the metadata of a user
    – You need to check for the metakey ‘{your WP prefix}_bbp_favorites’ of all the (active) users and analyse the comma-separated string of the meta_values
    – Then you can count the times that your topic ID is found

    Pascal.


    Loc Pham
    Participant

    @phamdacloc

    Actually, there’s a function for this already and it’s called: bbp_get_topic_favoriters($postID).

    Hope this helps others looking for something similar.

    -Loc

    @phamdacloc
    +1 for you ! I still learn everyday 🙂
    Thanks,
    Pascal.


    Robkk
    Moderator

    @robkk

    @phamdacloc

    Glad you found the solution to your issue. Sorry i wasn’t much help, it is hard to know every single function in the plugin. I am digging in the code more and more though.


    Allyson Souza
    Participant

    @allysonsouza

    +1, thank you!

    This link must be better indexed in google! 😛

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