Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/25/2014 06:30:56 PM (10 years ago)
Author:
boonebgorges
Message:

Improve validation and documentation for groups_create_group() and BP_Groups_Group::save()

Fixes #5214

Props r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-classes.php

    r8069 r8157  
    265265
    266266        do_action_ref_array( 'groups_group_before_save', array( &$this ) );
     267
     268        // Groups need at least a name
     269        if ( empty( $this->name ) ) {
     270            return false;
     271        }
     272
     273        // Set slug with group title if not passed
     274        if ( empty( $this->slug ) ) {
     275            $this->slug = sanitize_title( $this->name );
     276        }
     277
     278        // Sanity check
     279        if ( empty( $this->slug ) ) {
     280            return false;
     281        }
     282
     283        // Check for slug conflicts if creating new group
     284        if ( empty( $this->id ) ) {
     285            $this->slug = groups_check_slug( $this->slug );
     286        }
    267287
    268288        if ( !empty( $this->id ) ) {
Note: See TracChangeset for help on using the changeset viewer.