Skip to:
Content

BuddyPress.org

Ticket #5672: 5672.bp-default.patch

File 5672.bp-default.patch, 1.1 KB (added by boonebgorges, 10 years ago)
  • functions.php

    diff --git functions.php functions.php
    index a4b39cc..8182ad2 100644
    function bp_dtheme_remove_nojs_body_class() { 
    790790}
    791791add_action( 'bp_before_header', 'bp_dtheme_remove_nojs_body_class' );
    792792
    793 ?>
     793/**
     794 * Ensure that multiselect boxes have trailing brackets in their 'id' and 'name' attributes.
     795 *
     796 * These brackets are required for an array of values to be sent in the POST
     797 * request. Previously, bp_get_the_profile_field_input_name() contained the
     798 * necessary logic, but since BP 2.0 that logic has been moved into
     799 * BP_XProfile_Field_Type_Multiselectbox. Since bp-default does not use the
     800 * BP_XProfile_Field_Type classes to build its markup, it did not inherit
     801 * the brackets from their new location. Thus this workaround.
     802 */
     803function bp_dtheme_add_brackets_to_multiselectbox_attributes( $name ) {
     804        global $field;
     805
     806        if ( 'multiselectbox' === $field->type ) {
     807                $name .= '[]';
     808        }
     809
     810        return $name;
     811}
     812add_filter( 'bp_get_the_profile_field_input_name', 'bp_dtheme_add_brackets_to_multiselectbox_attributes' );