-1

I have created a an extra profile field on Buddypress registration page for users to select their native language using the profile fields area on Buddypress.

Once the user has registered and made this selection I want it their input to show on user-edit.php in wordpress backend so the admin of the site can see what native language that user is.

My extra profile field id is 136

How would I get this to show on the user-edit.php page?

Alan Carr
  • 322
  • 2
  • 9
  • 25

1 Answers1

-1

Put this function in your theme/functions.php or in plugins/bp-custom.php

It should appear at the bottom of user-edit.php

function show_136_field ( $user ) { 

    $field_value = xprofile_get_field_data( 136, $user->ID, $multi_format = 'comma' );
    echo "<br />Language: " . $field_value . "<br />";

}
add_action( 'edit_user_profile', 'show_136_field' );

You can also get the field value with the field name rather than id.

$field_value = xprofile_get_field_data( 'Language', $user->ID, $multi_format = 'comma' );

If the $field_value is an array and $multi_format = 'comma', a csv string will be returned.

shanebp
  • 1,904
  • 3
  • 17
  • 28