Skip to:
Content

BuddyPress.org

Ticket #2947: 2947.001.patch

File 2947.001.patch, 3.5 KB (added by r-a-y, 14 years ago)
  • buddypress/bp-xprofile/bp-xprofile-templatetags.php

     
    187187                if ( $class )
    188188                        $css_classes[] = sanitize_title( esc_attr( $class ) );
    189189
    190                 /* Set a class with the field ID */
     190                // Set a class with the field ID
    191191                $css_classes[] = 'field_' . $profile_template->field->id;
    192192
    193                 /* Set a class with the field name (sanitized) */
     193                // Set a class with the field name (sanitized)
    194194                $css_classes[] = 'field_' . sanitize_title( $profile_template->field->name );
    195195
    196196                if ( $profile_template->current_field % 2 == 1 )
     
    387387                                        $option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
    388388                                        $option_values = (array)$option_values;
    389389
    390                                         /* Check for updated posted values, but errors preventing them from being saved first time */
     390                                        // Check for updated posted values, but errors preventing them from being saved first time
    391391                                        foreach( (array)$option_values as $i => $option_value ) {
    392392                                                if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != $option_value ) {
    393393                                                        if ( !empty( $_POST['field_' . $field->id] ) )
     
    411411                                for ( $k = 0; $k < count($options); $k++ ) {
    412412                                        $option_value = BP_XProfile_ProfileData::get_value_byid($options[$k]->parent_id);
    413413
    414                                         /* Check for updated posted values, but errors preventing them from being saved first time */
     414                                        // Check for updated posted values, but errors preventing them from being saved first time
    415415                                        if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) {
    416416                                                if ( !empty( $_POST['field_' . $field->id] ) )
    417417                                                        $option_value = $_POST['field_' . $field->id];
     
    432432                        case 'checkbox':
    433433                                $option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id);
    434434
    435                                 /* Check for updated posted values, but errors preventing them from being saved first time */
     435                                // Check for updated posted values, but errors preventing them from being saved first time
    436436                                if ( isset( $_POST['field_' . $field->id] ) && $option_values != maybe_serialize( $_POST['field_' . $field->id] ) ) {
    437437                                        if ( !empty( $_POST['field_' . $field->id] ) )
    438438                                                $option_values = $_POST['field_' . $field->id];
     
    454454                                break;
    455455
    456456                        case 'datebox':
     457                                $date = BP_XProfile_ProfileData::get_value_byid($field->id);
    457458
    458                                 if ( !empty( $field->data->value ) ) {
    459                                         $day = date("j", $field->data->value);
    460                                         $month = date("F", $field->data->value);
    461                                         $year = date("Y", $field->data->value);
     459                                if ( !empty( $date ) ) {
     460                                        $day = date("j", $date);
     461                                        $month = date("F", $date);
     462                                        $year = date("Y", $date);
    462463                                        $default_select = ' selected="selected"';
    463464                                }
    464465
    465                                 /* Check for updated posted values, but errors preventing them from being saved first time */
     466                                // Check for updated posted values, but errors preventing them from being saved first time
    466467                                if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
    467468                                        if ( $day != $_POST['field_' . $field->id . '_day'] )
    468469                                                $day = $_POST['field_' . $field->id . '_day'];
     
    529530                                                break;
    530531                                }
    531532
    532                                 apply_filters( 'bp_get_the_profile_field_datebox', $html, $day, $month, $year, $default_select );
    533 
     533                               
     534                                $html = apply_filters( 'bp_get_the_profile_field_datebox', $html, $type, $day, $month, $year, $default_select );
    534535                                break;
    535536                }
    536537