BP_REST_Account_Settings_Options_Endpoint::get_profile_fields()
Get Fields for the Profile “Privacy”.
Description
- From: ‘members/single/settings/profile’
Return
(array|mixed|void)
Source
File: bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | public function get_profile_fields() { $fields = array (); $field_groups = bp_xprofile_get_groups( array ( 'fetch_fields' => true, 'fetch_field_data' => true, 'fetch_visibility_level' => true, ) ); if ( ! empty ( $field_groups ) ) { foreach ( $field_groups as $group ) { $fields [] = array ( 'name' => '' , 'label' => '' , 'field' => '' , 'value' => '' , 'options' => array (), 'group_label' => $group ->name, ); if ( isset( $group ->fields ) && ! empty ( $group ->fields ) ) { foreach ( $group ->fields as $field ) { $fields [] = array ( 'name' => 'field_' . $field ->id, 'label' => $field ->name, 'field' => ( ! empty ( $field ->__get( 'allow_custom_visibility' ) ) && 'allowed' === $field ->__get( 'allow_custom_visibility' ) ) ? 'select' : '' , 'value' => xprofile_get_field_visibility_level( $field ->id, bp_loggedin_user_id() ), 'options' => array_column( bp_xprofile_get_visibility_levels(), 'label' , 'id' ), 'group_label' => '' , ); } } } } return $fields ; } |
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.