Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/13/2021 04:16:04 AM (3 years ago)
Author:
imath
Message:

xProfile: make sure a Field Type can enforce field visibility

When saving a field having a Field Type where the custom visibility feature is disabled and the visibility property is set, use this visibility to enforce the field visibility. This part was forgotten in #7162 and it is needed by the Checkbox Acceptance field to make sure only the logged in user can see they agreed to the page requiring their acceptance.

Props mahdiar, vapvarun

See #4747

File:
1 edited

Legend:

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

    r12868 r12881  
    558558
    559559                    if ( ! $field->field_type_supports( 'allow_custom_visibility' ) ) {
    560                         $default_visibility = 'public';
     560                        $default_visibility          = 'public';
     561                        $available_visibility_levels = bp_xprofile_get_visibility_levels();
     562
     563                        if ( isset( $field->type_obj->visibility ) && in_array( $field->type_obj->visibility, array_keys( $available_visibility_levels ), true ) ) {
     564                            $default_visibility = $field->type_obj->visibility;
     565                        }
    561566                    }
    562567
Note: See TracChangeset for help on using the changeset viewer.