Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jul 2 '11 at 22:38

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

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
share|improve this answer
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
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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