Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show additional fields on member profile header


  • Naomi
    Participant

    @livingcminca

    I’m running WP 4.4.2 and Buddypress 2.5.2 on my site http://www.charlottemasoneducation.org

    I’d like to add the member’s city and state to the member profile page right where it says when their last activity was.

    I have added these fields in a theme-my-login-custom.php file in order for them to be part of the registration process to my private site which I’m using the TML plugin for.

    From reading other threads, it sounds like I need to edit the member-header.php file?

    Here is the section that I think I need to add code to. Can you please tell me what code I would need to add and where to add it in order to have those fields show up correctly?

    <?php endif; ?>
    
    	<span class="activity"><?php bp_last_activity( bp_displayed_user_id() ); ?></span>
    
    	<?php do_action( 'bp_before_member_header_meta' ); ?>
    
    	<div id="item-meta">
    
    		<?php if ( bp_is_active( 'activity' ) ) : ?>
    
    			<div id="latest-update">
    
    				<?php bp_activity_latest_update( bp_displayed_user_id() ); ?>
    
    			</div>
    
    		<?php endif; ?>
    
    		<div id="item-buttons">
    
    			<?php do_action( 'bp_member_header_actions' ); ?>
    
    		</div><!-- #item-buttons -->
    
    		<?php
    		/***
    		 * If you'd like to show specific profile fields here use:
    		 * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field
    		 */
    		 do_action( 'bp_profile_header_meta' );
    
    		 ?>
    
    	</div><!-- #item-meta -->
    
    </div><!-- #item-header-content -->
    
    <?php do_action( 'bp_after_member_header' ); ?>
    
    <?php do_action( 'template_notices' ); ?>
Viewing 8 replies - 1 through 8 (of 8 total)

  • shanebp
    Moderator

    @shanebp

    You have identified the correct code location:

    Assuming your field names are City and State, try:

    bp_member_profile_data( 'field=City' );
    bp_member_profile_data( 'field=State' );

    If you need to do some formatting or add text or check for empty fields, use:

    $city = bp_get_member_profile_data( 'field=City' );
    echo $city;

    ngoegan
    Participant

    @ngoegan

    I’m sorry, but where exactly in that code would I enter that? Like this?

    <?php
    /***
    * If you’d like to show specific profile fields here use:
    * bp_member_profile_data( ‘field=About Me’ ); — Pass the name of the field
    */
    do_action( ‘bp_profile_header_meta’ );

    bp_member_profile_data( ‘field=City’ );
    bp_member_profile_data( ‘field=State’ );

    ?>


    ngoegan
    Participant

    @ngoegan

    I tried this and it isn’t showing up on profile pages:

    <?php do_action( 'bp_member_header_actions' ); ?>
    
    		</div><!-- #item-buttons -->
    
    		<?php
    		/***
    		 * If you'd like to show specific profile fields here use:
    		 * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field
    		 */
    
    bp_member_profile_data( 'field=city' );
    bp_member_profile_data( 'field=state' );
    
    		 do_action( 'bp_profile_header_meta' );
    
    		 ?>
    

    shanebp
    Moderator

    @shanebp

    Edit this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\single\member-header.php

    If you have cover images enabled, edit this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\single\cover-image-header.php

    Either way, you should be creating template overloads.


    ngoegan
    Participant

    @ngoegan

    Does “your theme” here mean my theme twenty twelve? Or do they mean some other buddypress theme folder?

    Template compatibility also runs a check to see if two directories or folders exist in a theme:

    ‘buddypress’
    ‘community’
    If either of these two folders exist in your theme and they contain BP template files then those files will be used in preference to the bp plugins versions.


    shanebp
    Moderator

    @shanebp

    They mean the theme that is currently activated.


    ngoegan
    Participant

    @ngoegan

    I still can’t get it to work. I do have header images enabled so I edited this file:

    buddypress\bp-templates\bp-legacy\buddypress\members\single\cover-image-header.php

    as follows:

    <?php
    
    				 /**
    				  * Fires after the group header actions section.
    				  *
    				  * If you'd like to show specific profile fields here use:
    				  * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field
    				  *
    				  * @since 1.2.0
    				  */
    		
    
    bp_member_profile_data( 'field=city' );
    bp_member_profile_data( 'field=state' );
    
    		 do_action( 'bp_profile_header_meta' );
    
    				 ?>
    
    			</div>

    Naomi
    Participant

    @livingcminca

    Can anyone help?

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