Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set activity filter to specific value


  • _tomr
    Participant

    @_tomr

    Hey!

    Usually I can figure stuff out for myself, but your functions are just nested too much for me to figure out how arguments are passed on.

    What I want to do: I want to create a site for my dormitory and I really only need a fragment of all the functionalities of buddy press. The only thing I really need are user pages and the activity page. And on there I only want to display those activities that are posted through the activities page itself, that is “activity_update” for the filter.

    I just spend 2 hours trying to find out where that is set, but with all those ajax stuff, I just can’t make it out… stupid ajax! ;)

    Could you please tell me where to set the filter to a specific value and not have it to be changeable by the user?! Just deleting the entries in the drop down obviously won’t work, I tried that, haha.

    Thanks a lot!

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

  • _tomr
    Participant

    @_tomr

    I did it! Jesus Christ, took me more than 4 hours to find that one line. It’s in activity-loop.php. Now, that was the easy part.

    <?php if ( bp_has_activities( 'action=activity_update' ) ) : ?>

    that’s how it’s supposed to look if you want to hard code the filter to one specific value. The hard part was finding out the proper argument for the bp_has_activities function. Well, now I got it. But seriously, why are you making it so hard for users to modify?

    Anyway, thats how it looked before editing:

    <?php if ( bp_has_activities( bp_dtheme_ajax_querystring( 'activity' ) ) ) : ?>

    I tried using the docs for buddypress, specifically this page:

    https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    But is it outdated, or is it just the wrong page for what I was looking for?


    Boone Gorges
    Keymaster

    @boonebgorges

    You’re right that the codex doesn’t always keep pace with the code. If you find something wrong in the codex, please take the initiative to fix it.

    When troubleshooting, the most surefire way to figure out (for example) which arguments a given function takes is to look at the definition of that function, where the core coders do a great job of documenting what goes in and out of the main functions. I believe that bp_has_activities is defined in bp-activity/bp-activity-templatetags.php, but you can always find where a function is defined by shelling into your buddypress plugin directory (or keeping a local copy on your hard drive) and typing something like the following from the command line (unix/mac):

    grep -nR 'bp_has_activites' ./

    By scanning that list you should be able to find where the function is defined.

    Another really great tool is the php xref http://bp-dev.org/phpxref/nav.html?_functions/index.html, but you should keep in mind that the version of BP cross referenced will not necessarily match your own.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set activity filter to specific value’ is closed to new replies.
Skip to toolbar