Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/10/2015 04:13:02 PM (9 years ago)
Author:
djpaul
Message:

xprofile: remove is_admin() logic from required field check

The function should return the same thing for everyone, as it’s a
property of the field only (not the field-user combo). In the relevant
places where these functions are used in BP - namely, during form
submission - bp_moderate users are able to bypass the requirement.

This change breaks backwards compatibility in cases where the
field_is_required() functions are called directly, and the plugin
expects the function to return true for bp_moderate users. This is
unlikely, and given that if there were, they’d run into this same bug,
let’s fix it.

Fixes #6520

Props boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-screens.php

    r10163 r10232  
    9999            }
    100100
    101             $is_required[$field_id] = xprofile_check_is_required_field( $field_id );
     101            $is_required[ $field_id ] = xprofile_check_is_required_field( $field_id ) && ! bp_current_user_can( 'bp_moderate' );
    102102            if ( $is_required[$field_id] && empty( $_POST['field_' . $field_id] ) ) {
    103103                $errors = true;
Note: See TracChangeset for help on using the changeset viewer.