Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

#7619 closed defect (bug) (fixed)

`groups_create_group()` messes with creator_id

Reported by: boonebgorges's profile boonebgorges Owned by: boonebgorges's profile boonebgorges
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords:
Cc:

Description

It's technically possible to update a group using groups_create_group(), but it is pretty finicky with respect to creator_id.

groups_create_group() assigns the logged-in user to creator_id. This means that, when running the function programatically or in a non-standard way, you have to manually pass creator_id to avoid having it overwritten with potentially incorrect information. https://buddypress.trac.wordpress.org/browser/tags/2.9.2/src/bp-groups/bp-groups-functions.php#L134

creator_id (and probably status?) should be inherited from the existing group, in the same way that $name and $slug are. https://buddypress.trac.wordpress.org/browser/tags/2.9.2/src/bp-groups/bp-groups-functions.php#L119

Attachments (1)

7619-other-params.diff (1.7 KB) - added by dcavins 7 years ago.
Fix handling of status, parent_id, enable_forum, and date_created parameters for existing groups.

Download all attachments as: .zip

Change History (4)

#1 @boonebgorges
7 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 11735:

Improve handling of creator_id when updating an existing group.

When updating an existing group using groups_create_group(),
the default value of creator_id should be the creator_id of that
existing group.

Fixes #7619.

#2 @boonebgorges
7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening because apparently this is a problem for other properties in groups_create_group().

@dcavins
7 years ago

Fix handling of status, parent_id, enable_forum, and date_created parameters for existing groups.

#3 @boonebgorges
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 11740:

Better parsing of params passed to groups_create_group().

This changeset rewrites the logic of the way default values are parsed,
so that values aren't inadvertently reset when updating an existing
group via groups_create_group().

Props dcavins.
Fixes #7619.

Note: See TracTickets for help on using tickets.