[buddypress-trac] [BuddyPress Trac] #6734: `groups_get_groups()` doesn't distinguish between `0` and falsey values for `user_id`

buddypress-trac noreply at wordpress.org
Mon Nov 23 18:32:30 UTC 2015

#6734: `groups_get_groups()` doesn't distinguish between `0` and falsey values for
 Reporter:  boonebgorges                         |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Under
Component:  Component - Groups                   |  Consideration
 Severity:  normal                               |     Version:
 Keywords:  2nd-opinion needs-patch needs-unit-  |  Resolution:
  tests                                          |

Comment (by boonebgorges):

 > Backwards compatibility here would be my main concern. I think we'd need
 to do some research in plugins and see what would happen if the change
 were made.

 Definitely. This is change not worth making if it's going to break
 anything significant. To be clear, it should be possible to write in such
 a way that full backward compatibility is maintained for the following
 uses of `groups_get_groups()`:

 groups_get_groups(); // default behavior remains
 groups_get_groups( array( 'user_id' => false ) ); // explicitly setting
 user_id to false

 The only "breaking" change (or, I'd say, "fixing" change) is the following

 groups_get_groups( array( 'user_id' => 0 ) );

 Currently, this results in all groups being returned; I'm suggesting it
 should result in no groups being returned. I'll look through the plugin
 repo to see how/whether `groups_get_groups()` is being used, but it'd be
 helpful to get a gut check from others - do we think that anyone is
 passing `0` as a user ID and *expecting* all groups?

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6734#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list