Skip to:
Content

Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#5449 closed defect (bug) (invalid)

bp_has_activities - include & exclude no longer working?

Reported by: shanebp Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.9.2
Component: 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)

comment:1 @shanebp18 months ago

  • Cc shane@… added

comment:2 @boonebgorges18 months ago

  • Keywords reporter-feedback added

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.

comment:3 @shanebp18 months ago

Keep in mind that the 'include' parameter refers to activity IDs.

Duh, so sorry, I was confusing activity loop with members loop.

You can filter by users with the 'user_id' parameter.

So, the 'user_id' parameter will accept a csv string of ids ? Or an array of ids ?

Last edited 18 months ago by shanebp (previous) (diff)

comment:4 @boonebgorges18 months 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() );

comment:5 @shanebp18 months ago

  • Keywords reporter-feedback removed

Yup, that's what I was trying, but passing it to the wrong parameter.

Embarrassing, but thanks for responding. And for closing this ticket.

Note: See TracTickets for help on using tickets.