Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/17/2017 06:57:20 PM (3 years ago)
Author:
dcavins
Message:

Update group update form logic to handle slug changes.

Add error cases for handling form input that may include group slug
updates.

See #6014.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-screens.php

    r11529 r11556  
    840840            $group_notify_members = isset( $_POST['group-notify-members'] ) ? (int) $_POST['group-notify-members'] : 0;
    841841
    842             if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], $group_notify_members ) ) {
     842            // Name and description are required and may not be empty.
     843            if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) ) {
     844                bp_core_add_message( __( 'Groups must have a name and a description. Please try again.', 'buddypress' ), 'error' );
     845            } elseif ( ! groups_edit_base_group_details( array(
     846                'group_id'       => $_POST['group-id'],
     847                'name'           => $_POST['group-name'],
     848                'slug'           => null, // @TODO: Add to settings pane? If yes, editable by site admin only, or allow group admins to do this?
     849                'description'    => $_POST['group-desc'],
     850                'notify_members' => $group_notify_members,
     851            ) ) ) {
    843852                bp_core_add_message( __( 'There was an error updating group details. Please try again.', 'buddypress' ), 'error' );
    844853            } else {
Note: See TracChangeset for help on using the changeset viewer.