Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 7 years ago

#7362 closed enhancement (maybelater)

Query only registered activity types like WP_Query does with post types

Reported by: offereins's profile Offereins Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Activity Keywords: needs-patch, trac-tidy-2018
Cc: lmoffereins@…

Description

Multiple times I find myself in a situation where private activity items* are near-impossible to hide for unpriviledged members. Especially when their plugin is removed or even temporally deactivated, and its shielding logic is absent, then the activity items are out in the open.

I suggest to go the WordPress way, like WP_Query handles post types: only query posts whose post types are registered (as does WP_Tax_Query for registered taxonomies). Meaning, that we'd register activity types in something like an array of bp_activity_types, and check that collection before querying activity items. This way, custom activity items are hidden by default, which would also benefit their presentation - when otherwise additional markup would be needed from their plugin.

Now, one can imagine that this has never been the case, because the Activity Stream in its current fashion is a great activity archive for data that isn't explicitly supported (registered) anymore, while still being relevant to the community.

The question is, what would be best to have as default?

*) Currently, there is no such thing as a 'private' activity item, but by ways of plugin filters, such items could be removed from the Activity Stream for certain members.

Change History (6)

#1 @Offereins
8 years ago

Just found out that bp_activity_set_action() comes with a like-minded notice:

 * While it's possible to post items to the activity stream whose types are
 * not registered using bp_activity_set_action(), it is not recommended;
 * unregistered types will not be displayed properly in the activity admin
 * panel, and dynamic action generation (which is essential for multilingual
 * sites, etc) will not work.

Essentially, this very mention is what I'd like to see in practice. The action types are already registered in $bp->activity->actions (per component), so there's no need for an additional bp_activity_types collection.

Perhaps we can offer an option toggle to add an additional query filter that does this. For now, I'll use a custom solution in my situation(s).

Last edited 8 years ago by Offereins (previous) (diff)

#2 @DJPaul
8 years ago

So - the short version of your suggestion - don't show activity items if the owning component/plugin is disabled (by checking to see if the type is registered)?

#3 @Offereins
8 years ago

Yes, by checking against the registered activity actions/types.

#4 @boonebgorges
8 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

This is great, @Offereins - Thanks for opening the ticket.

Just to underscore what you've said above: I wouldn't want to make it impossible to query for items of a non-registered activity type. There are plenty of situations where you want and need to do such a thing (think: migrations). But it seems right to me that you would not query them by default.

In addition, moving to an activity-type whitelist for queries will move us to a model where activity types can register themselves with certain permissions. Think of exclude_from_search, publicly_queryable, etc in WP.

#5 @DJPaul
7 years ago

  • Keywords trac-tidy-2018 added

We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.

Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.

If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.

For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/

#6 @DJPaul
7 years ago

  • Milestone Awaiting Contributions deleted
  • Resolution set to maybelater
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.