#5449 closed defect (bug) (no action required)
bp_has_activities - include & exclude no longer working?
Reported by: | shanebp | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.9.2 |
Component: | Activity | Keywords: | |
Cc: | shane@… |
Description
In template > activity-loop.php
This:
if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&include=3' ) ):
Or this:
if ( bp_has_activities( 'include=3' ) ):
Results in this:
'Sorry, there was no activity found. Please try a different filter.'
Changing to '&exclude=3' shows all members, including user_id 3, so it is effectively ignored.
Change History (5)
#3
@
11 years ago
Keep in mind that the 'include' parameter refers to activity IDs.
Duh, so sorry, I was confusing activity loop with members loop.
Would it be reasonable to request the expansion of the activity loop scope parameter to allow more than one argument?
Per a solution to this question:
http://buddypress.org/support/topic/only-friendsyou-in-activity-feed-has-solution-been-found/
Probably a real pain, but thought I'd ask before suggesting that she use the filter at the end of bp_has_activities()
#4
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Would it be reasonable to request the expansion of the activity loop scope parameter to allow more than one argument?
It'd be complicated. Each value of $scope is shorthand for a combination of other parameters (eg, 'scope=groups' translates to 'object=groups&primary_id=[listofgroupids]'). Allowing for multiple scopes would mean the ability to join parameter combinations into chunks, separated by booleans. This is a pretty major change in the way we currently build our queries. Not out of the question, but definitely too hard to do now. Feel free to open a separate enhancement ticket for it.
For a short term solution to the thread in question, get a list of friend IDs, add the logged-in user to the list, and then pass to 'user_id':
$include = array_merge( array( bp_loggedin_user_id(), friends_get_friend_user_ids( bp_loggedin_user_id() );
It's working OK for me.
Keep in mind that the 'include' parameter refers to activity IDs. You can filter by users with the 'user_id' parameter. Your "Sorry, there was no activity found" message suggests that you have no activity item with the id 3 in the database.
Also, keep in mind that your first example won't always be parsed correctly. If
bp_ajax_querystring( 'activity' )
is empty, then adding&include=3
to it will result in an invalid querystring.Have another go using these tips, and let me know what you find. If you're still having problems, please post back with details on how to reproduce.