Skip to:
Content
Pages
Categories
Search
Top
Bottom

Dispaly Nickname instead of username


  • nightstalker101
    Participant

    @nightstalker101

    At the moment I call the username with the following templatetag:

    <?php bp_the_site_member_name() ?>

    When I call it in this way, it displays the full name and not the Nick name (username).

    Is there any function, to call the user name?

    Lars

Viewing 25 replies - 1 through 25 (of 30 total)

  • Jeff Sayre
    Participant

    @jeffsayre

    bp_core_get_username() is used to fetch the username of a user based on their user id.


    nightstalker101
    Participant

    @nightstalker101

    thanks, and what are the arguments I have to add in the brackets?


    Jeff Sayre
    Participant

    @jeffsayre

    I totally missed the templatetag part–sorry.

    Try bp_the_site_member()


    nightstalker101
    Participant

    @nightstalker101

    It does not work, I call it in the mebers loop with these lines (try to call it):

    href=”<?php bp_the_site_member_link() ?>”><?php bp_the_site_member() ?>

    But only the link Appears in the source, no Linktext.


    Burt Adsit
    Participant

    @burtadsit

    Jeff had it right the first time. You just need to supply the user id.

    bp_core_get_username( bp_the_site_member_user_id() );


    Jeff Sayre
    Participant

    @jeffsayre

    Nightstalker101-

    Is this working for you now?

    Burt, I told you I was tired. I should not be posting when my head is fuzzy. :(


    nightstalker101
    Participant

    @nightstalker101

    I get an error Message, again. I will reinstall bp +wpmu.

    What´s the latest version from Wpmu?

    That one in the branches folder or that and the trunk folder on the svn site?


    Andy Peatling
    Keymaster

    @apeatling

    Use the 2.7 branch of WPMU.


    nightstalker101
    Participant

    @nightstalker101

    okay,

    update /reinstallation done. But the username (Nickname) is not diplayed yet. When I call it with these lines:

    bp_core_get_username( bp_the_site_member_user_id() );

    I get a number displayed….the registration order. Admin is 1, the first Testuser 2……

    Why?


    Paul Wong-Gibbs
    Keymaster

    @djpaul

    What file are you putting this code into, and where?


    nightstalker101
    Participant

    @nightstalker101

    I put it into the members-loop.php in my own the file (functions php is the newest from bp).


    nightstalker101
    Participant

    @nightstalker101

    oh:

    “><?php bp_core_get_username( bp_the_site_member_user_id() ); ?>

    into these lines, to get the userlink


    nightstalker101
    Participant

    @nightstalker101

    No one here, that can help me?


    Jeff Sayre
    Participant

    @jeffsayre

    Nightstalker101-

    Okay, two things. First, you need to echo out the statement. Second, you need to supply the user’s id. I usually place the current user ID in a variable I call $memberID.

    <?php echo bp_core_get_username( bp_the_site_member_user_id($memberID) ); ?>

    Try that out and let me know how it goes!


    nightstalker101
    Participant

    @nightstalker101

    Hi,

    the same again. It echos a number. (the order, the user have registered) Look here:

    http://pc-store.org/members

    (site is not fnished, yet; Url will chnage, too)

    Lars


    Jeff Sayre
    Participant

    @jeffsayre

    Try hardcoding a user number, say “2”, in there and see what happens. Just a test.


    nightstalker101
    Participant

    @nightstalker101

    You mean in this way:

    ` href=”<?php bp_the_site_member_link() ?>”><?php // bp_the_site_member_name() ?>2<?php echo bp_core_get_username( bp_the_site_member_user_id($memberID) ); ?>´

    I get usernames like: 21 You, 22You and so on..

    Lars


    Jeff Sayre
    Participant

    @jeffsayre

    Lars-

    I’m just trying to see what may be going on. So, try this and see what it echos out for member name:

    <?php echo bp_core_get_username( bp_the_site_member_user_id(2) ); ?>


    nightstalker101
    Participant

    @nightstalker101

    Hi,

    the same again, only numbers.


    Jeff Sayre
    Participant

    @jeffsayre

    Really? Does it still say “You”?


    nightstalker101
    Participant

    @nightstalker101

    no, only a number:

    http://pc-store.org/members


    trcwest
    Participant

    @trcwest

    if you just want to echo the user name for a url how can i do this.. there doesnt seem to be a exact answere.. eg

    /group/create/”>


    trcwest
    Participant

    @trcwest

    http://spotskenya.com/groups/&lt;? bp_core_get_username( bp_the_site_member_user_id() );?> /group/create/”

    oops


    Jeff Sayre
    Participant

    @jeffsayre

    Okay, the number is not created by the code I asked yo to try. It is created by the previous code. The “You” is created by the code I provided.

    A couple of questions:

    1. Do you have three, separate user accounts each with a different email address?

    2. Are you logged in when trying this out? If so, log out, clear cache, and try again.

    3. Would you paste your misbehaving code in http://pastebin.com/ and provide a link?


    nightstalker101
    Participant

    @nightstalker101

    1. At least two user have different email accounts, maybe three.

    2. Yes. I logged out, now, cleared the browser cache and looked again (as non user). I see “You” and the number again.

    3. http://pastebin.com/m561e11dd

    Thanks,

    Lars

Viewing 25 replies - 1 through 25 (of 30 total)
  • The topic ‘Dispaly Nickname instead of username’ is closed to new replies.
Skip to toolbar