URGENT – Nickname displays in address bar
-
Hi, I have an URGENT problem, I have created the buddypress forum which HAS to be ONLY accessible by members and is to be COMPLETELY anonymous to all members (only admin to see real names and emails).
Unfortunately when a user registers the Nickname field is auto populated from the users name which means when you click on there username and it takes you to the members page in the address bar it displays their real name :-O
I have manually changed the users nickname to be their username+1 and that now displays in the address bar.Is there a function or something I can put in to change this as I cant be going in and manually editing all users as they register.
-
ok, I’m not quite clear on what you want to happen
so when I register I complete what information?
and which bits of that information do you want to hide?
and what do you want to happen instead
please come back with a sequence, so that we can work out the best solution
Dont know why my post arent showing up
Sorry I thought I was but you know what its like when your in the middle of it 🙂
The site is gaucinforum.com
When you go there you can only access the home page the contact page and terms etc without being registered.The registration page is standard bbpress with 3 additional fields (not really relevent)
The user registers with
Username : japs
Name : John PowellIn the background it has created a user with
Username : japs
First Name : John
Last Name : Powell
Nickname : John Powell
Display Name Publicly : John PowellI am using the plugin BP Display Name to force Display Name Publicly As : Username
and I have added the code
define( ‘BP_SHOW_DISPLAYNAME_ON_PROFILE’, false );
to my wp-config.phpNow if I login as a different user (just normal member/subscriber) and I click his name (japs from any post he made) it takes me to his profile page where in the address bar it says
http://www.gaucinforum.com/members/john-powell/This is a major problem as the site has to be anonymous to all but the admin.
If I go in and edit the user japs
and change the Nickname : japs1
I cant have japs as it wont let merefresh the members page and the address bar now says
http://www.gaucinforum.com/members/japs1/This is perfectly fine or if it said
http://www.gaucinforum.com/members/japs/
that would be fine too.I am assuming there is some code in the bbpress members pages that says to use nickname instead of username?
or is there some php to add to my functions to make wp register users nicknames as there username with a 1 or something.
I hope that makes it clear whats happening and what I need to happen?
Thanks
Marksorry for the delay in replying, weekend and other commitments
when you say
The user registers with
Username : japs
Name : John Powellthe standard wordpress registration only asks for username and email, and then allocates the nickname as username.
What is adding firstname/lastname to your registration?
Hi Robin,
I do understand I too have had other things to do.
I dont know what you mean by “the standard wordpress registration” do you mean the standard bbpress registration ?
I installed WordPress, I installed bbpress, I installed Buddy Press
The default registration page is now NOT the default wordpress it is the bbpress registration?
And by default the bbpress plugin ads “Profile Fields” of which there is a default set of “NAME” which you cant delete and IS required. I believe it is this field that is transferring to the “Nickname” field and causing the problem.https://www.dropbox.com/s/3mzrx6ry5stb7mh/deault%20Profle%20Field.jpg?dl=0
See the pic above
I have just run a test, i registered
Username : testing2
Name : Testing TwoHere is a screen shot of what registered
https://www.dropbox.com/s/lxu0vysxd3edams/deault%20Profle%20Field2.jpg?dl=0So the first and last name are definitely being filled out from that default Name field (dont really care about the first and last name, its the nickname thats the problem)
Any ideas? I cant go live with this site promising anonymity and then have the users name displayed in the address bar 😕
Thanks
Markok, that is buddypress adding the profile fields, so you may need to take it up with them if the next bit doesn’t work !
However whilst doing something for someone else today, I found a function on the net, which I have amended (but not tested) below
function change_display_name( $user_id ) { $info = get_userdata( $user_id ); $args = array( 'ID' => $user_id, 'display_name' => $info->user_login ); wp_update_user( $args ); } add_action('user_register','change_display_name');
then on registration it should set the display_name to the username
put this in your functions file
and do let me know if it works !
Hi Robin,
Thanks again for getting back, Not directed at you but that made me mad… >-|
I posted in the BuddyPress forum before posting here and they saidf it was a bbpress problem…. I have just had a week of various website problems and every one (except yourself) have only been interested in blaming someone else or someone elses plugin and in no way interested in helping fix the problem.Rant over…. 🙂
I tried your code in my functions.php but unfortunatly it broke the site and just kept telling me there was an unexpected & in line 127Line 127 was
” & # 039 ; display_name' => $info->user_login ) ; ”
'display_name' => $info->user_login );(ah I dont know why it keeps changing what im pasting)
Any idea what is wrong there?
Thanks
MarkHow odd the code I got in the email is different from the code as pasted here in the forum ????
https://www.dropbox.com/s/tff64o2g5kan3r4/code%20error.jpg?dl=0
M
yes that’s to do with how wordpress stores stuff.
the code you need to use is in the post above, don’t use the email one !
Try again and come back !
Ok Just tried that and NO good.
It still sets the Display Name to the Same as the Nickname which is the Full Name.M
Having said that it does appear to be using the username now in the address bar ???
Weird, I haven’t changed anything from the other day that should effect that?I have read in another forum somewhere that they noticed this randomness with user registrations as well???
Maybe I will just have to keep my eye on it as people register.
Thanks for your help though it was refreshing to have someone at least try to help 🙂
MHaving said that it does appear to be using the username now in the address bar ???
with my code in, or without?
ok, let’s try setting both
function change_display_name( $user_id ) { $info = get_userdata( $user_id ); $args = array( 'ID' => $user_id, 'display_name' => $info->user_login ); 'nickname' => $info->user_login ); wp_update_user( $args ); } add_action('user_register','change_display_name');
This should set both display_name and nickname to the username
ooo that broke it ?
Got this error
Parse error: syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW) in /home/alpacasp/public_html/gaucinforum.com/wp-content/themes/ta_divi-et/functions.php on line 128and Line 128 reads:
‘nickname’ => $info->user_login );oops sorry didn’t take the ); out of the previous line
try
function change_display_name( $user_id ) { $info = get_userdata( $user_id ); $args = array( 'ID' => $user_id, 'display_name' => $info->user_login , 'nickname' => $info->user_login ); wp_update_user( $args ); } add_action('user_register','change_display_name');
Success I believe.
Did 6 test users all with the same results.
See pics
Registered with
Username : testing6
Name: Testing SixAs you can see from the User details pic the Nickname field stored is still the full name but see member details pic and every time it displayed the username in the address bar.
https://www.dropbox.com/s/6jilo126qldruoe/Test6%20-%20User%20details.jpg?dl=0
https://www.dropbox.com/s/5b6ewgv59c9uxip/Test6%20-%20Member%20details.jpg?dl=0This is absolutely fine by me 🙂
Thank you thank you thank you !
Mark
Hey great – glad we got there in the end !
- You must be logged in to reply to this topic.