[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
noreply at wordpress.org
Mon Jun 3 01:49:06 UTC 2013
#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: 1.8
Component: Groups | Version: 1.5.5
Severity: normal | Resolution:
Keywords: |
--------------------------+--------------------
Comment (by boonebgorges):
I don't think we should be returning `null` or `false`. `$foo = new
BP_Groups_Group()` should return a `BP_Groups_Group` object, regardless of
whether there's a corresponding group. See the behavior of `WP_Post` and
`WP_User`. I'm willing to be persuaded that the wrapper function
`groups_get_group()` ought to return `null` for non-existent group ids,
but that's not the subject of this ticket: the OP was referring to plugins
that are checking against `BP_Groups_Group` itself. Those plugins are
simply doing it wrong.
We should, however, probably be setting the `id` property to 0 in this
case. I'm not persuaded that this'll really break much of anything - what
is a scenario in which it's important for `BP_Groups_Group::id` to be set
for a non-existent group? I'm just going to make the change, and we'll see
if any plugins are doing anything strange during the beta period.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4185#comment:8>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list