Skip to:
Content

BuddyPress.org

Changeset 5948


Ignore:
Timestamp:
03/29/2012 01:17:22 PM (12 years ago)
Author:
boonebgorges
Message:

Fixes problems is bp_get_the_profile_field_options():

  • In 'checkbox' case, cast existing values as an array, to avoid misunderstandings with count() and in_array() later in the function
  • In 'checkbox' case, replace call to non-existent 'value' variable to something that makes sense in context
  • Clears up PHP warnings, and allows for better maintenance of existing values when switching between xprofile field types.

Fixes #4102

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5/bp-xprofile/bp-xprofile-template.php

    r5229 r5948  
    526526            case 'checkbox':
    527527                $option_values = BP_XProfile_ProfileData::get_value_byid( $field->id );
    528                 $option_values = maybe_unserialize( $option_values );
     528                $option_values = (array) maybe_unserialize( $option_values );
    529529
    530530                // Check for updated posted values, but errors preventing them from being saved first time
     
    545545                        $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false );
    546546
    547                         if ( $option_values[$j] == $allowed_options || @in_array( $allowed_options, $value ) ) {
     547                        if ( $option_values[$j] == $allowed_options || @in_array( $allowed_options, $option_values ) ) {
    548548                            $selected = ' checked="checked"';
    549549                            break;
Note: See TracChangeset for help on using the changeset viewer.