Dispaly Nickname instead of username
-
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
-
bp_core_get_username() is used to fetch the username of a user based on their user id.
thanks, and what are the arguments I have to add in the brackets?
I totally missed the templatetag part–sorry.
Try bp_the_site_member()
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.
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() );
Nightstalker101-
Is this working for you now?
Burt, I told you I was tired. I should not be posting when my head is fuzzy.
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?
Use the 2.7 branch of WPMU.
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?
What file are you putting this code into, and where?
I put it into the members-loop.php in my own the file (functions php is the newest from bp).
oh:
“><?php bp_core_get_username( bp_the_site_member_user_id() ); ?>
into these lines, to get the userlink
No one here, that can help me?
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!
Hi,
the same again. It echos a number. (the order, the user have registered) Look here:
(site is not fnished, yet; Url will chnage, too)
Lars
Try hardcoding a user number, say “2”, in there and see what happens. Just a test.
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
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) ); ?>
Hi,
the same again, only numbers.
Really? Does it still say “You”?
no, only a number:
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
http://spotskenya.com/groups/<? bp_core_get_username( bp_the_site_member_user_id() );?> /group/create/”
oops
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?
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
- The topic ‘Dispaly Nickname instead of username’ is closed to new replies.