Skip to:

Sort BuddyPress Activity Stream by Profile Field (Location)?

  • truelux


    I have a Nationwide BuddyPress website, so the activity stream can become confusing since people from all over are posting updates/content. I’d like to give members the ability to sort the activity based on their chosen location in their profile (drop down).

    If a person wants to view a BuddyPress stream from members in New York, then they should be able to… Not based on GeoLocation but on the state selected in their profile.

    How can I filter activity based on the users location, which is chosen via drop down menu in Users > Profile Fields > State ?

    Someone had mentioned – “Another approach is filtering on sql query which may be a little bit more efficient.” but I’m not sure where to start with that one 🙁

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

  • danbp


    Do you mean 1st. strategy explained here ?

    BuddyPress Activity Shortcode: Embed BuddyPress Activities anywhere



    No, this displays the latest activity for all users.

    I want to show latest activity for users based on their State (profile) selection.

    <?php bp_member_profile_data(array('field' => 'State')); ?>



    In one of the comments, it’s yet explained. (july 9th 2015)

    Read throught, built the ID list of the concerned users and add it to activity loop filter options

    Another approach is to use the buit-in fonctionnality of profile fields. The value is linked to any member ho filled the same value.

    This means that if you click New York on a profile, you get a list of all user who entered New York and by extension, you have access to all new-yorker activities.

    But if you want to sort the site activity of NY users only, you need to use the first solution and to code a bit more to add also a SWA filter for any existing state…

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