Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/29/2013 08:11:14 PM (10 years ago)
Author:
boonebgorges
Message:

Make field visibility settings option ids unique

The 'id' attribute of xprofile visibility settings options was being
concatenated in such a way that there were sometimes conflicts between
different fields. Besides being bad practice, this also caused occasional
problems where changing one field's setting would inadvertently change
another's, due to browser behavior regarding duplicate ids.

Fixes #5248

File:
1 edited

Legend:

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

    r7599 r7617  
    939939            $checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : '';
    940940
    941             $html .= '<li><label for="see-field_' . esc_attr( $level['id'] ) . '"><input type="radio" id="see-field_' . esc_attr( $level['id'] ) . '" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr( $level['id'] ) . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
     941            // Only sanitize once
     942            $field_id = bp_get_the_profile_field_id();
     943            $level_id = esc_attr( $level_id );
     944
     945            $html .= '<li><label for="see-field_' . $field_id . '_' . $level_id . '"><input type="radio" id="see-field_' . $field_id . '_' . $level_id . '" name="field_' . $field_id . '_visibility" value="' . $level_id . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
    942946        }
    943947
Note: See TracChangeset for help on using the changeset viewer.