Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)

  • Mad-As-A-Writer
    Participant

    @tinytiger

    Just wanted to say a HUGE thank you to @tatiana_k, using your tutorial I was able to find the bp_nouveau_member_hook( 'before', 'header_meta' ); hook in the Buddyboss member-header.php and in that I added an action to insert a profile field “tagline” below a user’s name on their profile. So before, a profile showed the avatar and Name, then on the next line the @mentionname but now it shows Avatar, Name, TAGLINE FROM PROFILE FIELD, @mentionname etc.

    My code:

    /*Add profile field 'tagline' to member profile, below member name*/
    add_action( 'bp_before_member_header_meta' , 'insert_tagline_in_profile' );
    function insert_tagline_in_profile(){
        $webdata = bp_get_member_profile_data( 'field=Tagline' );
    	if( $webdata != false )
    	echo '<div class="member-tagline">' . $webdata . '</div>';
        }

    Note, if you are using a profile field like Favourite Quote, you would replace Tagline in the field above with your field, ie ‘field=Favourite Quote’.

    Thanks to Tatiana I was able to realise I needed bp_before_member_header_meta as the hook, by adding bp / before (from the bp_nouveaux function) / member (because it’s inside the member section) / header_meta (from the bp_nouveaux function).

    If you want another example, I was able to use it to display the same field in the Activity Feed, but in this case I ended up adding the code directly to a template file copied into my child functions.php instead of using the hook, because I wanted the data nested in with the name etc instead of on the line below, but in case it helps anyone, the code to add a profile field below the user info in the activity feed is:

    /*add Tagline to activity feed user info using nouveau loop - no good for me as it
    inserts after the user header instead of inside it*/
    add_action( 'bp_before_activity_activity_content' , 'insert_tagline_in_feed' );
    function insert_tagline_in_feed(){
        $profile_id = bp_get_activity_user_id();
          $tagline_data = xprofile_get_field_data( 'Tagline', $profile_id);
          if( $tagline_data != false ){
              echo '<div class="activity-tagline">' . $tagline_data . '</div>';
          }
        }

    Once again my heartfelt thanks!

Viewing 1 replies (of 1 total)
Skip to toolbar