#4184 closed enhancement (fixed)
Exclude specific user_id’s when querying for activities
| Reported by: | username_ | Owned by: | espellcaste |
|---|---|---|---|
| Priority: | normal | Milestone: | 11.0.0 |
| Component: | Activity | Version: | |
| Severity: | normal | 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
@
10 years ago
- Summary exclude specific user_id’s in bp_has_activity() query → Exclude specific user_id’s when querying for activities
#3
@
10 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
@
10 years ago
#6
@
10 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.
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
4 years ago
#10
@
4 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I see the value in this. Similar to
post__inandpost__not_ininWP_Queryclass.What about the naming?
user_idanduser_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().