Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/24/2013 04:01:11 PM (10 years ago)
Author:
djpaul
Message:

XProfile: Show the placeholder text for all select box profile fields.

Prior to BP 1.5, the "----" placeholder item for select boxes was shown for both optional and mandatory fields. In BP 1.5 in r4831, the behaviour was changed to only show the placeholder item for optional profile fields. With retrospect, that change didn’t make much sense.

This commits restores the original behaviour, showing the placeholder text for all select box profile fields. A user should be forced to pick an option for a required profile field, and not allow the web browser to automatically select the first option in the <select> element.

See #3378, #3698, and #5184. Props haykayltduk, hnla, DJPaul at WordCamp London contributor day!

File:
1 edited

Legend:

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

    r7150 r7599  
    438438        global $field;
    439439
    440         // Generally a required dropdown field will not get a blank value at
    441         // the top. Set 'null_on_required' to true if you want this blank value
    442         // even on required fields.
    443440        $defaults = array(
    444             'type'             => false,
    445             'null_on_required' => false
     441            'type' => false,
    446442        );
    447443
     
    473469            case 'selectbox':
    474470
    475                 if ( !$field->is_required || $null_on_required ) {
    476                     $html .= '<option value="">' . /* translators: no option picked in select box */ __( '----', 'buddypress' ) . '</option>';
    477                 }
     471                $html .= '<option value="">' . /* translators: no option picked in select box */ __( '----', 'buddypress' ) . '</option>';
    478472
    479473                $original_option_values = '';
Note: See TracChangeset for help on using the changeset viewer.