Skip to:
Content

BuddyPress.org

Ticket #7391: 7391-new-function-approach.patch

File 7391-new-function-approach.patch, 1.6 KB (added by hnla, 8 years ago)

Creates a new function check for default vis level.

  • src/bp-templates/bp-legacy/buddypress/members/register.php

     
    181181                                                         */
    182182                                                        do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
    183183
    184                                                         if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
     184                                                        if ( bp_allow_profile_visibility_change() ) : ?>
    185185                                                                <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
    186186                                                                        <?php
    187187                                                                        printf(
  • src/bp-xprofile/bp-xprofile-functions.php

     
    11431143}
    11441144
    11451145/**
     1146 * Checks what default visibility level is set for a field in a profile edit loop.
     1147 * returns false if the field default does not allow user change.
     1148 *
     1149 * @since 2.7.4
     1150 *
     1151 * @return bool
     1152 */
     1153function bp_allow_profile_visibility_change() {
     1154
     1155        $retval = false;
     1156        $field_id = bp_get_the_profile_field_id();
     1157
     1158        if( 'disabled' === bp_xprofile_get_meta( $field_id, 'field', 'allow_custom_visibility' ) ) {
     1159                $retval = false;
     1160        } else {
     1161                $retval = true;
     1162        }
     1163
     1164        return $retval;
     1165}
     1166
     1167/**
    11461168 * Get the ids of fields that are hidden for this displayed/loggedin user pair.
    11471169 *
    11481170 * This is the function primarily responsible for profile field visibility. It works by determining