#4184 closed enhancement (fixed)
Exclude specific user_id’s when querying for activities
Reported by: | username_ | Owned by: | 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)
Change History (13)
#2
@
8 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
#3
@
8 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.
#5
@
8 years ago
#6
@
8 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.
#8
@
3 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.
2 years ago
#10
@
2 years 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.
I see the value in this. Similar to
post__in
andpost__not_in
inWP_Query
class.What about the naming?
user_id
anduser_id_not
?We basically need to create
BP_Activity_Activity::get_not_in_operator_sql()
. We already haveBP_Activity_Query::get_sql_for_clause()
which does supportNOT IN
.See also
bp_activity_get()
,BP_Activity_Activity::get()
,bp_has_activities()
.