[buddypress-trac] [BuddyPress] #4185: Calling groups_get_group() with a non-existent group id returns a BP_Groups_Group object populated with the provided ID

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri May 4 10:14:38 UTC 2012


#4185: Calling groups_get_group() with a non-existent group id returns a
BP_Groups_Group object populated with the provided ID
--------------------------+-----------------------------
 Reporter:  chriskeeble   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Groups        |    Version:  1.5.5
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 A number of BuddyPress plugins use checks for whether a group exists by ID
 using calls such as:

 e.g. #1

 {{{
 if (!$group = groups_get_group(array('group_id' => $id))) {
 }}}

 e.g. #2

 {{{
 !groups_get_group(array('group_id' => $id))
 }}}

 If no group with the specified ID exists, should the BP_Groups_Group
 constructor set the ID property to null? It currently leaves it set to
 whatever value was passed in.

 Ideally groups_get_group should return null (though this could be a
 breaking change?)

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4185>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list