Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/26/2013 05:46:44 PM (9 years ago)
Author:
boonebgorges
Message:

Introduces meta_query paramater for bp_has_activities() stack

This will allow plugin and theme authors to filter the contents of the activity
stream based on information stored in the activitymeta table, using the
powerful meta_query syntax familiar from the 'meta_query' WP_Query param.

Also adds unit test for 'meta_query' in BP_Activity_Activity::get(), and
integration test for bp_has_activities(). These tests are primarily designed
to ensure that our param gets passed properly down the stack; we rely on WP
to get the meta_query logic right.

See #3521

Props ericlewis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-template.php

    r6926 r6948  
    151151            'filter'           => false,
    152152            'search_terms'     => false,
     153            'meta_query'       => false,
    153154            'display_comments' => 'threaded',
    154155            'show_hidden'      => false,
     
    173174        // Fetch all activity items
    174175        else
    175             $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam ) );
     176            $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'meta_query' => $meta_query, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam ) );
    176177
    177178        if ( !$max || $max >= (int) $this->activities['total'] )
     
    362363        'secondary_id'     => false,        // secondary object ID to filter on e.g. a post_id
    363364
     365        'meta_query'       => false,        // filter on activity meta. See WP_Meta_Query for format
     366
    364367        // Searching
    365368        'search_terms'     => false         // specify terms to search on
     
    455458        'filter'           => $filter,
    456459        'search_terms'     => $search_terms,
     460        'meta_query'       => $meta_query,
    457461        'display_comments' => $display_comments,
    458462        'show_hidden'      => $show_hidden,
Note: See TracChangeset for help on using the changeset viewer.