Last active
February 3, 2020 17:13
-
-
Save sagarjadhav/56eec4dee4792ea4fce1689a6a300e89 to your computer and use it in GitHub Desktop.
BuddyPress - Get a List of Defined xProfile fields - http://wordpress.stackexchange.com/questions/121634/buddypress-get-a-list-of-defined-xprofile-fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Xprofile get fileds by group | |
if ( bp_has_profile( array( 'user_id' => $user_id ) ) ) { | |
while ( bp_profile_groups() ) : bp_the_profile_group(); | |
$group_name = bp_get_the_profile_group_name(); | |
if ( ( 'Social' == $group_name) && bp_profile_group_has_fields() ) { | |
echo '<div id="bb-profile-group-fields">'; | |
while ( bp_profile_fields() ) : bp_the_profile_field(); | |
if ( bp_field_has_data() ) : | |
$name = bp_get_the_profile_field_name(); | |
$class = sanitize_title( $name ); | |
$value = bp_get_the_profile_field_edit_value(); | |
echo '<a href="' . esc_url( $value ) . '" ><i class="fa fa-' . $class . '" aria-hidden="true"></i></a> '; | |
endif; | |
endwhile; | |
echo '</div>'; | |
} | |
endwhile; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment