Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Order/sort activity by “most favorites”

@dankicity

Member

You’d need to (this is most undoubtedly wrong)
`
‘SELECT wp_bp_activity.id as id
FROM wp_bp_activity
LEFT JOIN wp_bp_activity_meta
ON wp_bp_activity.id = wp_bp_activity_meta.activity_id
WHERE wp_bp_activity_meta.meta_key = “favorite_count”
GROUP BY wp_bp_activity.id
HAVING COUNT (wp_bp_activity_meta.activity_id) > 0
ORDER BY COUNT (wp_bp_activity.id) DESC
LIMIT 20′
`
The reason I merged these is that you should be able to SELECT * activity and set them all as the $activity_template->activities and use the activity_template loop (bp_has_activities) but my attempts so far have failed.

Skip to toolbar