bp_get_the_profile_field_visibility_level_label()

Return the visibility level label of this field.

Description

Return

(string)

Source

File: bp-xprofile/bp-xprofile-template.php

960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
function bp_get_the_profile_field_visibility_level_label() {
    global $field;
 
    // On the registration page, values stored in POST should take
    // precedence over default visibility, so that submitted values
    // are not lost on failure.
    if ( bp_is_register_page() && ! empty( $_POST['field_' . $field->id . '_visibility'] ) ) {
        $level = esc_html( $_POST['field_' . $field->id . '_visibility'] );
    } else {
        $level = ! empty( $field->visibility_level ) ? $field->visibility_level : 'public';
    }
 
    $fields = bp_xprofile_get_visibility_levels();
 
    /**
     * Filters the profile field visibility level label.
     *
     * @since BuddyPress 1.6.0
     * @since BuddyPress 2.6.0 Added the `$level` parameter.
     *
     * @param string $retval Field visibility level label.
     * @param string $level  Field visibility level.
     */
    return apply_filters( 'bp_get_the_profile_field_visibility_level_label', $fields[ $level ]['label'], $level );
}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.