Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/10/2015 04:13:02 PM (10 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-template.php

    r10201 r10232  
    836836        global $field;
    837837
    838         // Define locale variable(s).
    839838        $retval = false;
    840839
    841         // Super admins can skip required check.
    842         if ( bp_current_user_can( 'bp_moderate' ) && !is_admin() ) {
    843             $retval = false;
    844 
    845         // All other users will use the field's setting.
    846         } elseif ( isset( $field->is_required ) ) {
     840        if ( isset( $field->is_required ) ) {
    847841            $retval = $field->is_required;
    848842        }
Note: See TracChangeset for help on using the changeset viewer.