[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
Wed Sep 7 16:12:07 UTC 2016


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

Comment (by dcavins):

 I searched through the WP Plugin Directory Slurped and came up with only a
 few instance where plugins were using `groups_get_groups()` with the
 `user_id` argument. In all cases, they were passing a user ID to get the
 user's groups, and I think would have been surprised to get a list of all
 groups. Here are the references:

 Topic Mover (and a fork)
 https://plugins.trac.wordpress.org/browser/buddypress-topic-mover/trunk
 /topic-mover.php#L43

 WP Idea Stream
 https://plugins.trac.wordpress.org/browser/wp-idea-
 stream/trunk/includes/buddypress/groups.php#L3875

 BP Group Hierarchy
 https://plugins.trac.wordpress.org/browser/bp-group-
 hierarchy/trunk/extension.php#L724

 JSON API for BP
 https://plugins.trac.wordpress.org/browser/json-api-for-
 buddypress/trunk/controllers/BuddypressRead.php#L292

 BuddyDrive and two forks, BuddyDrive S3 and BuddyBox
 https://plugins.trac.wordpress.org/browser/buddydrives3/trunk/includes
 /buddydrive-item-template.php#L113

 BP XML RPC Receiver and a fork
 https://plugins.trac.wordpress.org/browser/buddypress-xmlrpc-
 receiver/trunk/bp-xmlrpc.php#L894
 https://plugins.trac.wordpress.org/browser/buddypress-xml-rpc-
 receiver/trunk/bp-xmlrpc.php#L894

 I think your proposed change would actually help these plugins do their
 jobs. If they're trying to find a user's groups and pass in a 0 because
 the current user isn't logged in, then the response should be no groups,
 because the current user doesn't belong to any.

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


More information about the buddypress-trac mailing list