Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to display the most popular activities?

  • @thelandman

    Participant

    With Buddypress a user has the ability to ‘favorite’ an activity item..

    Is there a way of displaying the most ‘favorite’ activity updates of all the users with in site. So it would basically be the most popular activity items… Just wondering how I would go about do this…

Viewing 2 replies - 1 through 2 (of 2 total)
  • @rogercoathup

    Participant

    I believe favourites are stored as activity meta information.

    Therefore, you should be able to write an SQL query that does the job for you. Retrieving a list of activity IDs ordered by a COUNT on the number of times it’s been favourited. You’d then loop through the popular IDs retrieving the info you wanted (name, etc.) – I guess you could even pull that in the query.

    I don’t know the field names / table names off the top of my head, but a scan of the DB should reveal it.

    There may be an easier way via the API.

    @rogercoathup

    Participant

    update: for an individual activity BP uses the function call $fav_count = bp_activity_get_meta( $activity_id, ‘favorite_count’ );

    If you look at bp_activity_get_meta you should be able to determine the table used, and the SQL query to build.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display the most popular activities?’ is closed to new replies.
Skip to toolbar