true ) );
$fields2 = array();
if ( ! empty( $profile_groups ) ) {
foreach ( $profile_groups as $profile_group ) {
if ( ! empty( $profile_group->fields ) ) {
$group_name = $profile_group->name;
foreach ( $profile_group->fields as $field ) {
// echo $field->id . ' - ' . $field->name . '
';
$id = 'bp_' . str_replace( ' ', '_', $field->name );
$fields2[ $id ] = sprintf( __( 'BP %s profile: %s', 'author-avatars' ), $group_name, $field->name );
}
}
}
}
self::$profiles_field_list = $fields2;
return self::$profiles_field_list;
}
/**
* @param $fields
*
* @return array
*/
public static function filter_profiles_fields( $fields ) {
return array_merge( $fields, self::list_profiles_fields() );
}
/**
* @param $display_extra
* @param $user
*
* @return string
*/
public static function get_profile_outputs( $display_extra, $user ) {
$out = '';
foreach ( $display_extra as $name ) {
$args = array(
'field' => str_replace( '_', ' ', str_replace( 'bp_', '', $name ) ), // Field name or ID.
'user_id' => $user->user_id,
);
// $out .= bp_get_profile_field_data( $args );
$profile_field_data = bp_get_profile_field_data( $args );
$css = ( false === $profile_field_data ) ? $name . ' aa_missing' : $name;
if( is_array( $profile_field_data ) ) {
$separator = apply_filters( 'aa_user_xprofile_array_separator', ', ' );
$profile_field_data = implode( $separator, $profile_field_data );
}
$out .= sprintf( apply_filters( 'aa_user_display_extra_template', '