Skip to:
Content
Pages
Categories
Search
Top
Bottom

Dispaly Nickname instead of username

  • Profile photo of Nightstalker101
    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)
  • Profile photo of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

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

    Profile photo of Nightstalker101
    nightstalker101
    Participant

    @nightstalker101

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

    Profile photo of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

    I totally missed the templatetag part–sorry.

    Try bp_the_site_member()

    Profile photo of Nightstalker101
    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.

    Profile photo of Burt Adsit
    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() );

    Profile photo of Jeff Sayre
    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. :(

    Profile photo of Nightstalker101
    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?

    Profile photo of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    Use the 2.7 branch of WPMU.

    Profile photo of Nightstalker101
    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?

    Profile photo of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

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

    Profile photo of Nightstalker101
    nightstalker101
    Participant

    @nightstalker101

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

    Profile photo of Nightstalker101
    nightstalker101
    Participant

    @nightstalker101

    oh:

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

    into these lines, to get the userlink

    Profile photo of Nightstalker101
    nightstalker101
    Participant

    @nightstalker101

    No one here, that can help me?

    Profile photo of Jeff Sayre
    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!

    Profile photo of Nightstalker101
    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

    Profile photo of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

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

    Profile photo of Nightstalker101
    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

    Profile photo of Jeff Sayre
    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) ); ?>

    Profile photo of Nightstalker101
    nightstalker101
    Participant

    @nightstalker101

    Hi,

    the same again, only numbers.

    Profile photo of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

    Really? Does it still say “You”?

    Profile photo of Nightstalker101
    nightstalker101
    Participant

    @nightstalker101

    no, only a number:

    http://pc-store.org/members

    Profile photo of Timothy West
    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/”>

    Profile photo of Timothy West
    trcwest
    Participant

    @trcwest

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

    oops

    Profile photo of Jeff Sayre
    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?

    Profile photo of Nightstalker101
    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