Opened 18 months ago

Last modified 5 months ago

#3857 new enhancement

Stop using hide_sitewide for privacy purposes

Reported by: boonebgorges Owned by: boonebgorges
Priority: major Milestone: Future Release
Component: Activity Version:
Severity: normal Keywords:
Cc: chrisclayton

Description

We currently mark activity items as hide_sitewide in two cases:

  • The activity item is duplicated by another one that is *not* hide_sitewide, is in the case of "John is friends with Boone" (hide_sitewide = 0) and "Boone is friends with John" (hide_sitewide = 1).
  • The activity item is not supposed to be shown to all members because of a privacy setting. In practice, this means that it was created in a hidden or private group, but in theory it could be for any reason.

We should stop using hide_sitewide for this purpose. It causes lots of problems. Here are just the few I could find in a couple minutes' search:
http://buddypress.trac.wordpress.org/ticket/2678
http://buddypress.trac.wordpress.org/ticket/3463
http://buddypress.trac.wordpress.org/ticket/2293

The only real surefire way to protect content in hidden/private groups is to do the proper queries at runtime. We might use logic like this in the activity query:

$non_public_group_ids = ids of all groups that are non-public
if ( is_user_logged_in() ) {
  $this_user_group_ids = ids of all this user's groups
  select from activity table where ( component != 'groups' OR item_id NOT IN ($non_public_group_ids) OR item_id IN ($this_user_group_ids) )
} else {
  select from activity table where ( component != 'groups' OR item_id NOT IN ($non_public_group_ids) )
}

This is going to make our query a bit slower, unfortunately. But we can aggressively cache the values of $non_public_group_ids and $this_user_group_ids, so that persistent caching will mostly eliminate those two queries.

Again, this is the only way to be really certain about this privacy stuff, so I think we have to do something like it. hide_sitewide has sorta worked up through now, but only just barely, and only through some hacks. Let's do it right, so that when and if we introduce finer-grained activity controls in BP core we will already have an example of how it ought to be done.

Let's talk about this early in the 1.7 cycle. It's something that's bothered me since I started using BP, so I would be happy to take it on as one of my tasks.

Change History (2)

  • Keywords 1.7-early removed

I have a feeling that this is going to take way more than we have time for in the 1.7 release, so I'm going to preemptively punt it (much as it pains me to do so).

  • Cc chrisclayton added
Note: See TracTickets for help on using tickets.