Skip to:
Content

BuddyPress.org

Ticket #4958: profile-field-vis.patch

File profile-field-vis.patch, 2.4 KB (added by dcavins, 11 years ago)

Profile Field Vis Dialog

  • bp-templates/bp-legacy/js/buddypress.js

    diff --git bp-templates/bp-legacy/js/buddypress.js bp-templates/bp-legacy/js/buddypress.js
    index 889c919..e463b0e 100644
    jq(document).ready( function() { 
    834834
    835835        jq('.field-visibility-settings-close').on( 'click', function() {
    836836                var settings_div = jq(this).parent();
     837                var vis_setting_text = jq(this).siblings('fieldset').find('input[type=radio]:checked').parent('label').text();
    837838
    838839                jq(settings_div).slideUp( 400, function(){
    839840                        jq(settings_div).siblings('.field-visibility-settings-toggle').fadeIn(800);
     841                        jq(settings_div).siblings('.field-visibility-settings-toggle').children('.current-visibility-level').html(vis_setting_text);
    840842                });
    841843
    842844                return false;
  • bp-xprofile/bp-xprofile-template.php

    diff --git bp-xprofile/bp-xprofile-template.php bp-xprofile/bp-xprofile-template.php
    index c6ecda3..5a949e3 100644
    function bp_the_profile_field_visibility_level() { 
    730730         */
    731731        function bp_get_the_profile_field_visibility_level() {
    732732                global $field;
    733 
    734                 $retval = !empty( $field->visibility_level ) ? $field->visibility_level : 'public';
     733                //On the registration page, values stored in POST should take precedence over default visibility
     734                if ( bp_is_register_page() && !empty( $_POST['field_' . $field->id . '_visibility'] ) ) {
     735                        $retval = $_POST['field_' . $field->id . '_visibility'];
     736                } else {
     737                        $retval = !empty( $field->visibility_level ) ? $field->visibility_level : 'public';
     738                }
    735739
    736740                return apply_filters( 'bp_get_the_profile_field_visibility_level', $retval );
    737741        }
    function bp_the_profile_field_visibility_level_label() { 
    747751         */
    748752        function bp_get_the_profile_field_visibility_level_label() {
    749753                global $field;
     754                //On the registration page, values stored in POST should take precedence over default visibility
     755                if ( bp_is_register_page() && !empty( $_POST['field_' . $field->id . '_visibility'] ) ) {
     756                        $level  = $_POST['field_' . $field->id . '_visibility'];
     757                } else {
     758                        $level  = !empty( $field->visibility_level ) ? $field->visibility_level : 'public';
     759                }
    750760
    751                 $level  = !empty( $field->visibility_level ) ? $field->visibility_level : 'public';
    752761                $fields = bp_xprofile_get_visibility_levels();
    753762
    754763                return apply_filters( 'bp_get_the_profile_field_visibility_level_label', $fields[$level]['label'] );