Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/12/2010 01:03:42 PM (15 years ago)
Author:
apeatling
Message:

Merging 1.2 branch with trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-templatetags.php

    r2810 r2842  
    343343        global $field;
    344344
    345         return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id );
     345        $array_box = false;
     346        if ( 'multiselectbox' == $field->type )
     347            $array_box = '[]';
     348
     349        return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id . $array_box );
    346350    }
    347351
     
    370374                    $html .= '<option value="">--------</option>';
    371375
    372                 for ( $k = 0; $k < count( $options ); $k++ ) {
    373                     $option_value = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id );
     376                for ( $k = 0; $k < count($options); $k++ ) {
     377                    $option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
     378                    $option_values = (array)$option_values;
    374379
    375380                    /* Check for updated posted values, but errors preventing them from being saved first time */
    376                     if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) {
    377                         if ( !empty( $_POST['field_' . $field->id] ) )
    378                             $option_value = $_POST['field_' . $field->id];
     381                    foreach( (array)$option_values as $i => $option_value ) {
     382                        if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != $option_value ) {
     383                            if ( !empty( $_POST['field_' . $field->id] ) )
     384                                $option_values[$i] = $_POST['field_' . $field->id];
     385                        }
    379386                    }
    380387
    381                     if ( $option_value == $options[$k]->name || $options[$k]->is_default_option )
     388                    if ( in_array( $options[$k]->name, (array)$option_values ) || $options[$k]->is_default_option )
    382389                        $selected = ' selected="selected"';
    383390                    else
     
    649656
    650657        /* admin/profile/edit/[group-id] */
    651         return apply_filters( 'bp_get_current_profile_group_id', $profile_group_id ); 
     658        return apply_filters( 'bp_get_current_profile_group_id', $profile_group_id );
    652659    }
    653660
Note: See TracChangeset for help on using the changeset viewer.