Skip to:
Content

BuddyPress.org

Changeset 9999


Ignore:
Timestamp:
07/05/2015 07:10:54 PM (10 years ago)
Author:
boonebgorges
Message:

Bail out of saving a group membership if the group_id or user_id props are not set.

In addition to basic validation, this also provides a roundabout way for
developers to noop a membership save at the 'group_member_before_save' hook.

Props r-a-y.
See #6524.

File:
1 edited

Legend:

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

    r9982 r9999  
    231231        do_action_ref_array( 'groups_member_before_save', array( &$this ) );
    232232
     233        // The following properties are required; bail if not met.
     234        if ( empty( $this->user_id ) || empty( $this->group_id ) ) {
     235            return false;
     236        }
     237
    233238        if ( !empty( $this->id ) ) {
    234239            $sql = $wpdb->prepare( "UPDATE {$bp->groups->table_name_members} SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = %s, is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id );
Note: See TracChangeset for help on using the changeset viewer.