Changeset 5792 for trunk/bp-xprofile/bp-xprofile-template.php
- Timestamp:
- 02/15/2012 08:44:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-template.php
r5789 r5792 25 25 var $user_id; 26 26 27 function __construct( $user_id, $profile_group_id, $hide_empty_groups = false, $fetch_fields = false, $fetch_field_data = false, $exclude_groups = false, $exclude_fields = false, $hide_empty_fields = false, $fetch_ privacy_level = false ) {27 function __construct( $user_id, $profile_group_id, $hide_empty_groups = false, $fetch_fields = false, $fetch_field_data = false, $exclude_groups = false, $exclude_fields = false, $hide_empty_fields = false, $fetch_visibility_level = false ) { 28 28 $this->groups = BP_XProfile_Group::get( array( 29 29 'profile_group_id' => $profile_group_id, … … 33 33 'fetch_fields' => $fetch_fields, 34 34 'fetch_field_data' => $fetch_field_data, 35 'fetch_ privacy_level' => $fetch_privacy_level,35 'fetch_visibility_level' => $fetch_visibility_level, 36 36 'exclude_groups' => $exclude_groups, 37 37 'exclude_fields' => $exclude_fields … … 159 159 $hide_empty_fields_default = ( !is_network_admin() && !is_admin() && !bp_is_user_profile_edit() && !bp_is_register_page() ); 160 160 161 // We only need to fetch privacy levels when viewing your own profile161 // We only need to fetch visibility levels when viewing your own profile 162 162 if ( bp_is_my_profile() || bp_current_user_can( 'bp_moderate' ) ) { 163 $fetch_ privacy_level_default = true;163 $fetch_visibility_level_default = true; 164 164 } else { 165 $fetch_ privacy_level_default = false;165 $fetch_visibility_level_default = false; 166 166 } 167 167 … … 173 173 'fetch_fields' => true, 174 174 'fetch_field_data' => true, 175 'fetch_ privacy_level' => $fetch_privacy_level_default,175 'fetch_visibility_level' => $fetch_visibility_level_default, 176 176 'exclude_groups' => false, // Comma-separated list of profile field group IDs to exclude 177 177 'exclude_fields' => false // Comma-separated list of profile field IDs to exclude … … 181 181 extract( $r, EXTR_SKIP ); 182 182 183 $profile_template = new BP_XProfile_Data_Template( $user_id, $profile_group_id, $hide_empty_groups, $fetch_fields, $fetch_field_data, $exclude_groups, $exclude_fields, $hide_empty_fields, $fetch_ privacy_level );183 $profile_template = new BP_XProfile_Data_Template( $user_id, $profile_group_id, $hide_empty_groups, $fetch_fields, $fetch_field_data, $exclude_groups, $exclude_fields, $hide_empty_fields, $fetch_visibility_level ); 184 184 return apply_filters( 'bp_has_profile', $profile_template->has_groups(), $profile_template ); 185 185 } … … 708 708 709 709 /** 710 * Echo the privacy level of this field710 * Echo the visibility level of this field 711 711 */ 712 function bp_the_profile_field_ privacy_level() {713 echo bp_get_the_profile_field_ privacy_level();712 function bp_the_profile_field_visibility_level() { 713 echo bp_get_the_profile_field_visibility_level(); 714 714 } 715 715 /** 716 * Return the privacy level of this field716 * Return the visibility level of this field 717 717 */ 718 function bp_get_the_profile_field_ privacy_level() {718 function bp_get_the_profile_field_visibility_level() { 719 719 global $field; 720 720 721 $retval = !empty( $field-> privacy_level ) ? $field->privacy_level : 'public';721 $retval = !empty( $field->visibility_level ) ? $field->visibility_level : 'public'; 722 722 723 return apply_filters( 'bp_get_the_profile_field_ privacy_level', $retval );723 return apply_filters( 'bp_get_the_profile_field_visibility_level', $retval ); 724 724 } 725 725 726 726 /** 727 * Echo the privacy level label of this field727 * Echo the visibility level label of this field 728 728 */ 729 function bp_the_profile_field_ privacy_level_label() {730 echo bp_get_the_profile_field_ privacy_level_label();729 function bp_the_profile_field_visibility_level_label() { 730 echo bp_get_the_profile_field_visibility_level_label(); 731 731 } 732 732 /** 733 * Return the privacy level label of this field733 * Return the visibility level label of this field 734 734 */ 735 function bp_get_the_profile_field_ privacy_level_label() {735 function bp_get_the_profile_field_visibility_level_label() { 736 736 global $field; 737 737 738 $level = !empty( $field-> privacy_level ) ? $field->privacy_level : 'public';739 $fields = bp_xprofile_get_ privacy_levels();738 $level = !empty( $field->visibility_level ) ? $field->visibility_level : 'public'; 739 $fields = bp_xprofile_get_visibility_levels(); 740 740 741 return apply_filters( 'bp_get_the_profile_field_ privacy_level_label', $fields[$level]['label'] );741 return apply_filters( 'bp_get_the_profile_field_visibility_level_label', $fields[$level]['label'] ); 742 742 } 743 743 … … 886 886 887 887 /** 888 * Echo the field privacy radio buttons888 * Echo the field visibility radio buttons 889 889 */ 890 function bp_profile_ privacy_radio_buttons() {891 echo bp_profile_get_ privacy_radio_buttons();890 function bp_profile_visibility_radio_buttons() { 891 echo bp_profile_get_visibility_radio_buttons(); 892 892 } 893 893 /** 894 * Return the field privacy radio buttons894 * Return the field visibility radio buttons 895 895 */ 896 function bp_profile_get_ privacy_radio_buttons() {896 function bp_profile_get_visibility_radio_buttons() { 897 897 $html = '<ul class="radio">'; 898 898 899 foreach( bp_xprofile_get_ privacy_levels() as $level ) {900 $checked = $level['id'] == bp_get_the_profile_field_ privacy_level() ? ' checked="checked" ' : '';899 foreach( bp_xprofile_get_visibility_levels() as $level ) { 900 $checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : ''; 901 901 902 $html .= '<li><input type="radio" name="field_' . bp_get_the_profile_field_id() . '_ privacy" value="' . esc_attr( $level['id'] ) . '"' . $checked . '> ' . esc_html( $level['label'] ) . '</li>';902 $html .= '<li><input type="radio" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr( $level['id'] ) . '"' . $checked . '> ' . esc_html( $level['label'] ) . '</li>'; 903 903 } 904 904 905 905 $html .= '</ul>'; 906 906 907 return apply_filters( 'bp_profile_get_ privacy_radio_buttons', $html );907 return apply_filters( 'bp_profile_get_visibility_radio_buttons', $html ); 908 908 } 909 909 ?>
Note: See TracChangeset
for help on using the changeset viewer.