BuddyDev

Search

[Resolved] show Xprofile Field Data in The Profile Header, exclude own profile

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #32486

    Hi there, I’m using the following code to show Xprofile Field Data in The Profile Header.

    I want the code excluded from profiles own profile. The only way I know is to exclude the code from being displayed with css .myaccount But it’s not wrapped in a div so I have no class to attack. What is best, adding a div class, or exclude own profile in the code?

    Help with both solutions would be much appreciated, thanks!

    /**
     * Buddypress Show Xprofile Field Data in The Profile Header.
     */
     
    function yzc_add_xprofile_field_data_in_profile_header( $name ) 
    
    {
    	
    	$field_data = xprofile_get_field_data( 'Alder', bp_displayed_user_id() );
    	if ( ! empty( $field_data ) ) {
    		echo '<br/><strong>Alder:</strong> ' . $field_data;
    	
    	$field_data = xprofile_get_field_data( 'Fra', bp_displayed_user_id() );
    	if ( ! empty( $field_data ) ) {
    		echo '  <br/> <strong>Fra:</strong> ' . $field_data;
    	
    	$field_data = xprofile_get_field_data( 'Job', bp_displayed_user_id() );
    	if ( ! empty( $field_data ) ) {
    		echo '<br/><strong>Job:</strong> ' . $field_data;
    			
    	}
    }
    } 
    }
    
    add_action( 'bp_before_member_header_meta', 'yzc_add_xprofile_field_data_in_profile_header' );
    
  • Keymaster
    (BuddyDev Team)
    Posts: 24636
    Brajesh Singh on #32491

    Hi Carsten,
    Thank you for the post.

    I have replied to your pther post
    https://buddydev.com/support/forums/topic/show-xprofile-field-data-in-the-profile-header-exclude-own-profile-2/#post-32490

    Regards
    Brajesh

The topic ‘ [Resolved] show Xprofile Field Data in The Profile Header, exclude own profile’ is closed to new replies.

This topic is: resolved