Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to use Username instead of Name ?

  • Avatar of OccipitaL
    OccipitaL
    Participant

    @occipital

    Hi,

    I want to use wordpress username in every field of my site instead of buddypress’ “Name”. ┬áIs it possible to disable the whole name system and use Username instead or to hide Name from every possible field and display Username instead.

    I’m totally newbie to this whole coding stuff, found a code and managed to hide “Name” field in profile edit but this is only preventing from changing it. I need to disable it or change it’s usage to Username. (in Activity feed, mentions & comments at least)

    In case anybody wonders what did I use for hiding Name from profile edit section;
    `add_filter(“xprofile_group_fields”,”bpdev_filter_profile_fields_by_usertype”,10,2);

    function bpdev_filter_profile_fields_by_usertype($fields,$group_id){

    //only disable these fields on edit page

    if(!bp_is_profile_edit())

    return $fields;

    //please change it with the name of fields you don’t want to allow editing

    $field_to_remove=array(“Name”,””);

    $count=count($fields);

    $flds=array();

    for($i=0;$iname,$field_to_remove))

    unset($fields[$i]);

    else

    $flds[]=$fields[$i];//doh, I did not remember a way to reset the index, so creating a new array

    }

    return $flds;`
    Added this code to bp-members-functions.php

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

You must be logged in to reply to this topic.