Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add field data on profile header


  • karmatiger
    Participant

    @karmatiger

    I’m looking for a way in order to place certain field data beside or just beneath the <h1> entry header of the profile page.

Viewing 1 replies (of 1 total)

  • danbp
    Moderator

    @danbp

    Hi @karmatiger,

    i moved your topic to it’s own location. Jumping into old topics which are not exactly related to your question is not a good practice. Thank you for comprehension.

    You can use the action hook bp_before_member_home_content which is between H1 and profile header image.
    The template containing it is in bp-templates/bp-legacy/buddypress/members/single/home.php

    To get the field value ( ie. field name is Address):

    function tralala() {
    if( bp_is_active( 'xprofile' ) && is_user_logged_in() ) :
      if ( $address = xprofile_get_field_data( 'Address', bp_get_member_user_id() ) ) :
    		echo $address;
    	endif;
    endif;
    add_action( 'bp_before_member_home_content', 'tralala' );

    Note: all templates have action hooks you can use to add content. You just have to read throught the files to get them and choose the most appropriate for you.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar