WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to figure this out for weeks now and can't get it figured out. Ideally I like to filter the activity post by: today, week, month, and year. If anyone could please point me in the right direction, I'd greatly appriciate it. Thanks in advance.


migration rejected from stackoverflow.com Aug 6 '14 at 18:43

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by gmazzap, birgire, toscho Aug 6 '14 at 18:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

One approach you can take is add your options to the dropdown box, then filter into bp_ajax_querystring make sure that you set it up to high enough priority so that you get it pre-populated by the default handler.

In your filter modify the query string to include specific actvity ids, which you can pull from the database directly.

Maybe there's an easier approach but this one is most flexible (allows maximum customization)

below is one of my filters doing something similar note that I have hardcoded the include

    /* process query string main filtering happens here */

    function fp_qs_filter($qs, $obj) {

        $scope=""; // our filter

        // if activity and not global
        $displayed_user = bp_displayed_user_id();
        if ($obj== 'activity' && (!empty($displayed_user)))  {

            $scope = 'include=18';


        if ($obj == 'members') {

//                $scope = 'include=1';

        // if we're filtering and we have additional parameters separate them by &
        $sep = (!empty($scope) && !empty($qs))  ? "&" :"";
        $nqs = $scope . $sep . $qs;
        var_dump($nqs. ' - '.  $obj);
        return $nqs;
    add_filter('bp_ajax_querystring', 'fp_qs_filter', 99,2); // make sure the filter fires as last
Piotr Kaluza, could you please explain how to use your example to add filter, which would return activities of the specific groups? – user15792 May 3 '12 at 15:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.