Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 19 months ago

Last modified 18 months ago

#4184 closed enhancement (fixed)

Exclude specific user_id’s when querying for activities

Reported by: username_'s profile username_ Owned by: espellcaste's profile espellcaste
Milestone: 11.0.0 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch has-unit-tests
Cc:

Description

I didn’t see an exclude option for user_id just activity_id.

I do see the ability to include user_ids to be queried and that it can be an array of user_ids, most likely for the single member pages. But this is inclusive and I would like to see maybe the option to exclude some users from the main activity wall. Say user A doesn’t want to see user B’s updates anymore because they are negative… Some members seem to get on others nerves.

This option seems more important as a buddypress site grows in members say 5,000.

I'll try to look into some possible work around for now but all I can come up with are slow work around algorithms.

Attachments (1)

4184.patch (7.8 KB) - added by imath 19 months ago.

Download all attachments as: .zip

Change History (13)

#1 @DJPaul
12 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @slaFFik
7 years ago

  • Summary changed from exclude specific user_id’s in bp_has_activity() query to Exclude specific user_id’s when querying for activities

I see the value in this. Similar to post__in and post__not_in in WP_Query class.

What about the naming? user_id and user_id_not?

We basically need to create BP_Activity_Activity::get_not_in_operator_sql(). We already have BP_Activity_Query::get_sql_for_clause() which does support NOT IN.

See also bp_activity_get(), BP_Activity_Activity::get(), bp_has_activities().

#3 @boonebgorges
7 years ago

  • Keywords needs-patch added

user_id__in and user_id__not_in seem the most consistent.

We basically need to create BP_Activity_Activity::get_not_in_operator_sql(). We already have BP_Activity_Query::get_sql_for_clause() which does support NOT IN.

It may be better - less code, more future-compatible - to translate the new parameters into BP_Activity_Query objects.

#4 @slaFFik
7 years ago

  • Milestone changed from Future Release to 2.8

#5 @slaFFik
7 years ago

See #6645, that seems should be done before this ticket.

Also #6843 somewhat related in terms of BP_Activity_Query usage.

Last edited 7 years ago by slaFFik (previous) (diff)

#6 @boonebgorges
7 years ago

  • Keywords good-first-bug needs-unit-tests added

If we wait for #6645, there's no way this'll make it into 2.8.

I don't see a problem with adding user_id__in etc and having them translated directly into SQL.

#7 @DJPaul
7 years ago

  • Milestone changed from 2.8 to Future Release

#8 @espellcaste
2 years ago

  • Milestone changed from Awaiting Contributions to 11.0.0
  • Owner set to espellcaste
  • Status changed from new to assigned

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


19 months ago

@imath
19 months ago

#10 @imath
19 months ago

  • Keywords has-patch has-unit-tests added; needs-patch good-first-bug needs-unit-tests removed

4184.patch is using the BP_Activity_Query class to generate SQL WHERE clause about including/excluding a list of user IDs. It also includes unit tests.

#11 @imath
19 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 13337:

Activity introduce 2 new parameters to BP_Activity_Activity::get()`

  • The user_id__in parameter makes it possible to retrieve activities for

a list of user IDs.

  • The user_id__not_in parameter makes it possible to exclude activity

posted by a list of user IDs from retrieved activities.

Props username_, slaFFik, boonebgorges

Fixes #4184

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


18 months ago

Note: See TracTickets for help on using tickets.