Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do I remove @username from buddypress member profiles

Viewing 20 replies - 1 through 20 (of 20 total)

  • Ben Hansen
    Participant

    @ubernaut

    you may be able to hide the element but you won’t be able to obscure the profile url so there’s really no way (at least that i know of) to make usernames truly private.


    samdg
    Participant

    @samdg

    Alright… and how should I do that? Hide the element.


    Ben Hansen
    Participant

    @ubernaut

    easiest way is probably by redefining the element as hidden through an overriding css rule, should work but i’m not sure i’d never personally tried, it’s sorta counter to the whole idea of a social network to do that i think and it’s possible it’s not quite that simple.


    samdg
    Participant

    @samdg

    thanks for the help.. I’m not a developer but I’ll see if I can do this myself πŸ™‚


    mattg123
    Participant

    @mattg123

    or go to member-header.php and remove it properly since hiding it with css means its visible inside the page source anyway, not very hidden


    samdg
    Participant

    @samdg

    Aha! That did it! Thanks Matt πŸ˜€


    mattg123
    Participant

    @mattg123

    np @samdg but as mentioned higher in the thread, removing the username from the url might be a different story


    metalmick
    Participant

    @metalmick

    Can’t find ‘member-header.php’. can please advise me… trying to get rid of this stupid @username!!!


    danbp
    Moderator

    @danbp

    Hi @metalmick


    @username
    on the profile header is displayed with this code in BP 1.9.2
    (see bp-themes/bp-default/members/single/members-header.php:28)

    if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?>
       <span class="user-nicename">@<?php bp_displayed_user_mentionname(); ?></span>
    endif; 

    The @ sign is hardcoded in the span, so you have to remove it manualy from the file.
    To do this, you can hide it with a CSS rule or you can remove the whole if statement if you use member-header.php file within a child theme/theme.

    A more elegant solution would be to do this with a function, so we haven’t to think about theme modification or to forgot a CSS rule or to check BP after each update.

    The function bp_displayed_user_mentionname is declared in /plugins/buddypress/bp-activity/bp-activity-template.php:1027

    As this function is a filter, we can simply remove it to remove the @username from the template. But because the hardcoded @ sign before the username, we have to add a CSS rule with the remove_filter function. The function above will do all that.

    Add these snippet to your bp-custom.php (read here if you don’t know this file)

    /* remove @username from the profile header */
    
    function bpfr_remove_mention_from_profile() {	
    
    	echo '<style> h2.user-nicename { display:none; } </style>'; // hide the h2 containing the @
    
    	if( bp_is_user() && ! bp_get_member_user_id() ) {  // be sure we get the right user_id
            $user_id = 'displayed: '. bp_displayed_user_id();
        } else {
            $user_id = 'get_member_user: '. bp_get_member_user_id();
        }
    
    	remove_filter( 'bp_get_displayed_user_mentionname', bp_activity_get_user_mentionname( bp_displayed_user_id() ) );
    	
    }
    add_filter( 'bp_get_displayed_user_mentionname', 'bpfr_remove_mention_from_profile' ); 

    Succesfully tested on BP 1.9.2 and 2.0 beta 1


    metalmick
    Participant

    @metalmick

    Hi,
    I have done exactly what you have said above. The @ username is still there and the script that has been added to the bp-custom.php file is appearing on view at the top of the website. Is there supposed to be more brackets or something?
    Malcolm


    metalmick
    Participant

    @metalmick

    This is what I did, ignoring the bit above:

    The function bp_displayed_user_mentionname is declared in /plugins/buddypress/bp-activity/bp-activity-template.php:1027

    As this function is a filter, we can simply remove it to remove the @username from the template. But because the hardcoded @ sign before the username, we have to add a CSS rule with the remove_filter function. The function above will do all that.

    Add these snippet to your bp-custom.php (read here if you don’t know this file)

    /* remove @username from the profile header */

    function bpfr_remove_mention_from_profile() {

    echo ‘<style> h2.user-nicename { display:none; } </style>’; // hide the h2 containing the @

    if( bp_is_user() && ! bp_get_member_user_id() ) { // be sure we get the right user_id
    $user_id = ‘displayed: ‘. bp_displayed_user_id();
    } else {
    $user_id = ‘get_member_user: ‘. bp_get_member_user_id();
    }

    remove_filter( ‘bp_get_displayed_user_mentionname’, bp_activity_get_user_mentionname( bp_displayed_user_id() ) );

    }
    add_filter( ‘bp_get_displayed_user_mentionname’, ‘bpfr_remove_mention_from_profile’ );


    metalmick
    Participant

    @metalmick

    I have just tried doing everything including the bit at the top and it’s still there and the script is still appearing on page.


    metalmick
    Participant

    @metalmick

    I have returned everything as it was but would appreciate your input as i still want to resolve this issue. Thank you for your patience.


    Squirrel
    Participant

    @mossyoak

    Add a css style rule to your header.php within the <head> tags

    I think it’s this to get rid of the mentions on the profile page:

    <style type="text/css">
    div#post-mention {
    display : none;
    }
    span.user-nicename {
    display : none;
    }
    </style>

    metalmick
    Participant

    @metalmick

    None of these are working! Still have @ username on profile page. πŸ™


    metalmick
    Participant

    @metalmick

    Why isn’t Buddypress doing something about this!! No social/dating site I have ever seen has this @ username!!
    Just don’t get it… give us a check box to get rid of it please.


    Squirrel
    Participant

    @mossyoak

    You are right the css override does not work sorry. I just remembered how I did this sorry, try this function to turn off mentions:

    // remove buddypress mentions
    add_filter( 'bp_activity_do_mentions', '__return_false' );

    Try Adding it to your theme functions file or a custom plugin.


    metalmick
    Participant

    @metalmick

    Dropped this script into my Aptana editor but it’s asking for some more code on the next line? Brackets?


    metalmick
    Participant

    @metalmick

    Removed

    if ( bp_is_active( ‘activity’ ) && bp_activity_do_mentions() ) : ?>
    <span class=”user-nicename”>@<?php bp_displayed_user_mentionname(); ?></span>
    endif;

    from

    bp-themes/bp-default/members/single/members-header.php:28)

    THAT DIDN’T WORK EITHER!


    danbp
    Moderator

    @danbp

    PBCK ! Annoying for you, but read here please before telling “it doesn’t work” and give some information about what and how you are handling your issue.
    https://buddypress.org/support/topic/when-asking-for-support-2/

    If you remove something from the original BP files, and this something is still appearing, you probably use a theme or a child theme containing this part.

    You should also clear your navigator history. This mostly resolve such situations. πŸ˜‰

Viewing 20 replies - 1 through 20 (of 20 total)
  • The topic ‘How do I remove @username from buddypress member profiles’ is closed to new replies.
Skip to toolbar