This topic has 6 replies, 2 voices, and was last updated 7 years by Radu.

  • Author
  • #124418
     5high-photohub
    Participant

    Hi,

    I’m trying to show members full name in their BP profile headers as well as their @user name. I did have it working a while ago by editing a copy of bp member-header.php in my child theme – but now it just doesn’t work!

    Has Kleo done something regarding this is an update?

    Would appreciate some help in fixing this.

    Many thanks, j

    #124532
     Radu
    Moderator

    Hi,

    Are you sure that the child theme is activated ? try to deactivate, activate.

    Also you can try with this plugin : https://wordpress.org/plugins/buddypress-real-names/

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #128623
     5high-photohub
    Participant

    @ Radu,

    Sorry it’s taken so long to reply – just as well though as (rather embarrassingly) i found that I had in fact forgotten to change back to my child theme after doing some tests with the original Kleo theme! Duh!

    BUT it’s still not working, yet it was a few months back- but now only showing the @username in members’ profiles.

    What I want, and had, is for the member’s full name to sit above the @users’ name just below it, and this is the code I’m using in the BP member-header.php in my child theme:

    COPY CODE
    <?php
    /**
     * Fires before the display of a member's header.
     * @since 1.2.0
     */
    do_action( 'bp_before_member_header' ); ?>
    
    <div id="item-header-avatar">
    	<a href="<?php bp_displayed_user_link(); ?>">
    
    		<?php bp_displayed_user_avatar( 'type=full' ); ?>
    
    	</a>
    </div><!-- #item-header-avatar -->
    
    <div id="item-header-content">
    
    	<?php if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?>
    		<br><h2 class="user-nicename"><?php bp_displayed_user_displayname(); ?></h2>/br>
    				<h2 class="user-nicename">@<?php bp_displayed_user_mentionname(); ?></h2>
    	<?php endif; ?>
    
    	<span class="activity"><?php bp_last_activity( bp_displayed_user_id() ); ?></span>
    
    	<?php

    And I’ve tried it with bp_displayed_user_displayname and bp_displayed_user_fullname.

    Can you confirm if I’ve put the code in the correct place? Or do I have to add something else in the child functions.php as I’ve read?

    I appreciate this isn’t essential to make my site work, but it makes it much easier for members.

    Many thanks, j

    #128624
     5high-photohub
    Participant

    PS: also tries with bp_displayed_user_niename and it doesn’t work. So I’m either inputing the wromg code or got it in the wrong place!
    Any ideas?
    Cheers, j

    #128785
     Radu
    Moderator

    Hi,

    Try like this

    COPY CODE
    
    $sq7bpusername = bp_displayed_user_displayname(bp_displayed_user_id());
    echo $sq7bpusername;
    

    If this it not works try to add global $bp before the declarations something like this

    COPY CODE
    
    global $bp;
    $sq7bpusername = bp_displayed_user_displayname(bp_displayed_user_id());
    echo $sq7bpusername;
    

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #129164
     5high-photohub
    Participant

    Thanks for your quick reply Radu.
    Just to be clear for the code placement, would I put your suggested code in the same BP member-header.php in my child theme? As it looks quite different to the code that’s currently there (as above).
    – If so could you clarify which bits it would replace in it?
    – And if not which file would I put it in?
    Cheers, j

    #129199
     Radu
    Moderator

    Instead of bp_displayed_user_displayname() from this context :

    /br>

    But this should work by default… try also to de-activate all plugins except buddypress and disable also the child theme and try again also if you have some cache plugin purche caches and de-activate it.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?