Skip to:
Content

BuddyPress.org

Ticket #2777: 2777-1.patch

File 2777-1.patch, 2.8 KB (added by boonebgorges, 15 years ago)
  • bp-xprofile/bp-xprofile-classes.php

     
    384384                                        $parent_id = $wpdb->insert_id;
    385385
    386386                                if ( 'radio' == $this->type ) {
    387                                         $options        = $_POST['radio_option'];
    388                                         $defaults       = $_POST['isDefault_radio_option'];
     387                                        $options        = apply_filters( 'xprofile_field_options_before_save', $_POST['radio_option'], 'radio' );
     388                                        $defaults       = apply_filters( 'xprofile_field_default_before_save', $_POST['isDefault_radio_option'], 'radio' );
    389389
    390390                                } else if ( 'selectbox' == $this->type ) {
    391                                         $options        = $_POST['selectbox_option'];
    392                                         $defaults       = $_POST['isDefault_selectbox_option'];
     391                                        $options        = apply_filters( 'xprofile_field_options_before_save', $_POST['selectbox_option'], 'selectbox' );
     392                                        $defaults       = apply_filters( 'xprofile_field_default_before_save', $_POST['isDefault_selectbox_option'], 'selectbox' );
    393393
    394394                                } else if ( 'multiselectbox' == $this->type ) {
    395                                         $options        = $_POST['multiselectbox_option'];
    396                                         $defaults       = $_POST['isDefault_multiselectbox_option'];
     395                                        $options        = apply_filters( 'xprofile_field_options_before_save', $_POST['multiselectbox_option'], 'multiselectbox' );
     396                                        $defaults       = apply_filters( 'xprofile_field_default_before_save', $_POST['isDefault_multiselectbox_option'], 'multiselectbox' );
    397397
    398398                                } else if ( 'checkbox' == $this->type ) {
    399                                         $options        = $_POST['checkbox_option'];
    400                                         $defaults       = $_POST['isDefault_checkbox_option'];
     399                                        $options        = apply_filters( 'xprofile_field_options_before_save', $_POST['checkbox_option'], 'checkbox' );
     400                                        $defaults       = apply_filters( 'xprofile_field_default_before_save', $_POST['isDefault_checkbox_option'], 'checkbox' );
    401401                                }
    402402
    403403                                $counter = 1;
     
    610610                        $title                          = __( 'Add Field', 'buddypress' );
    611611                        $action                         = "admin.php?page=bp-profile-setup&group_id=" . $this->group_id . "&mode=add_field#tabs-" . $this->group_id;
    612612
    613                         $this->name                     = $_POST['title'];
    614                         $this->description      = $_POST['description'];
    615                         $this->is_required      = $_POST['required'];
    616                         $this->type                     = $_POST['fieldtype'];
    617                         $this->order_by         = $_POST["sort_order_{$this->type}"];
    618                         $this->field_order      = $_POST['field_order'];
     613                        if ( !empty( $_POST['saveField'] ) ) {
     614                                $this->name                     = $_POST['title'];
     615                                $this->description      = $_POST['description'];
     616                                $this->is_required      = $_POST['required'];
     617                                $this->type                     = $_POST['fieldtype'];
     618                                $this->order_by         = $_POST["sort_order_{$this->type}"];
     619                                $this->field_order      = $_POST['field_order'];
     620                        }
    619621                } else {
    620622                        $title                          = __( 'Edit Field', 'buddypress' );
    621623                        $action                         = "admin.php?page=bp-profile-setup&mode=edit_field&group_id=" . $this->group_id . "&field_id=" . $this->id . "#tabs-" . $this->group_id;