[buddypress-trac] [BuddyPress Trac] #4988: bp_has_activities to accept multi scope
buddypress-trac
noreply at wordpress.org
Wed Aug 27 17:41:26 UTC 2014
#4988: bp_has_activities to accept multi scope
-------------------------+------------------
Reporter: henrywright | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.2
Component: Activity | Version: 1.2
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------
Changes (by r-a-y):
* keywords: needs-patch => has-patch
* version: 1.7 => 1.2
* milestone: Future Release => 2.2
Comment:
`01.patch` supports multiple scopes.
The patch does a few things:
* Adds `'scope'` as an actual parameter in `BP_Activity_Activity::get()`.
Before, `'scope'` was only used in `bp_has_activities()`.
* Moves the hardcoded scope code from `bp_has_activities()` to the new
`BP_Activity_Activity::get_scope_query_sql()` method. Component scopes
are now also handled in their respective components instead of inside the
activity component.
* Adds a new `BP_Activity_Query` class to handle multiple relation
clauses. (Think of this as a simplified version of `WP_Meta_Query`.)
* Adds a new `'filter_query'` parameter in
`BP_Activity_Activity::get()`, which uses this.
* `BP_Activity_Activity::get_scope_query_sql()` also uses this.
Passes existing unit tests. Also added a unit test to show how multiple
scopes will work.
There are some things in `get_scope_query_sql()` that needs some feedback.
You'll notice an `'override'` array. This is necessary because scopes
need to be able to supercede some existing activity arguments (eg.
`user_id=0` for friends and groups scopes). Read the inline comments for
more info.
Feedback appreciated.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4988#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list