Skip to:

Placing a set profile filed beside users name in h1 title

  • Jonbie


    On sign-up to my website, users are asked there account type in a custom profile field (Type of account).

    At the top of every buddypress page in the h1 title area the users name appears. I am looking for a way to place the profile field “Type of account” beside the username in the page title?

    I have been looking into this for a couple of weeks without any luck as my coding skills are just not up to the challenge,

    any help would be very much appreciated as it is one of the last things i need to do before i can launch my website,

    Thanks guys and gals!

Viewing 6 replies - 1 through 6 (of 6 total)
  • A familiarity with BP templates is going to be essential here so if you aren’t first step is to check the codex and give a quick read to the guides on working with Theme Compatibility which will help explain how to create copies of the BP templates for modification; then an understanding of how WP child themes work so you can safely modify files without losing the changes.

    Then if you open member-header.php you will actually see a commented explanation on how to do what you want, you will then need to move the function to a position you want in that file i.e above/below the heading markup, wrap it in a suitable html element e.g ‘<p>’ or a span if you want to use it within the heading tag and style as wished.



    Hi Hugo,

    Thanks for the quick reply.

    I have a child theme already set up and i have put the following code into member-header.php but i am unsure of exactly where to put it and if the code is 100% accurate?

    <div id=’member_profile’>
    <div class=’profile_fields’>Category: <span><?php echo bp_get_profile_field_data(array(‘Type of account’ => ‘Type of account’));?></span></div>

    Why did you not use the given example in the file?


    That’s a self echoing function so need for ‘echo’ & it can be used in a members loop.

    You can pass the args as an array but as ‘field’ & ‘user_id’ but again in the example it shows you simply (‘field=my-field’)

    You can use the function as you have but no need to use it’s ‘get’ version unless you want to prevent it displaying but you can only pass the two args as mentioned ‘field’ & ‘user_id’ if you leave out user_id it defaults to displayed_user_id.

    A for where it goes that’s up to you, can’t really tell you where to place it that depends on what looks right for your layout.



    If you want to show profile data in the members loop
    ( as you seem to want in this thread: )

    You may be interested in this premium plugin:




    Thanks Shanebp,

    I am nearly there with the code, going to keep trying rather than install another plugin.

    appreciate the suggestion though.



    Hi hugo,

    Thanks for the instructions, i am finding it hard to follow as i am only coding a very short time with php.

    I have used @modemlooper code,

    <?php echo xprofile_get_field_data( ‘name of field’ );?>

    it works but im not sure where to add it. I have tried everywhere within the member-header.php.

    the page title in everypage is the users name. I want the profiled field to be displayed beside their name.

    any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Placing a set profile filed beside users name in h1 title’ is closed to new replies.
Skip to toolbar