Hi there,
I would liike my site users to enter a username only once. The standard solution provided by Advanced Profile I have to enter a username and a Password (at registration) and have to enter another Name for my user Profile.
Now since I have installed LoginToBoggan, my users can login to the page with their eMail address and therefore they don't need the username anymore.
I think it's a bit confusing, that they have to enter two "Usernames" and would like to disable the Username at my "UserProfile" (CCK/Bio Module) and would like to user the Username which is given at registration instead.
My problem is that I don't know how to display this Username on the Profile Page "All about user", since this Panel uses the CCK Field of the user profile.
As workaround I installed the module "computed field" and the module "cck field permissions". I made the Basic Info field "field_name" as a computed field, which receives the User name from the $user ubject with this code (I did not manage to do it via default value for cck fields):
global $user;
$node_field[0]['value'] = $user->name;
And I am also hiding it via the CCK field permission. Additionally I selected the field_name within the bio module as "registration form field". Since I hide it it's not showing up on registration.
The problem is that the value of the username is not saved during registration. It is only saved after the user edits his User Profile for the first time, because this is the time, when the computed field receives the value from the $user object for the very first time.
This means, that after registration the field "Name" within the all about user panel is empty. I would like to get the value there from the beginning.
Does anyone have a solution for this issue?
thanks in advance and best regards,
Hauke
Comments
Comment #1
michelleI don't know what you're talking about. There is no field for user name on the node type created by APK.
Michelle
Comment #2
hawkster commentedI can't remember if this field was included from the beginning in APK, but I think the field name was "Name". Anyway, within the field group "Basic Info" I have the two fields "Name" (field_name) and "Location" (field_location) now. In the Mini Panel "All about User" (user_basics) I am displaying these fields.
I want the content of the "field_name" to be the same as the username, which is entered at registration. My Approach to achieve this is described above.
Another solution would be to display the username of the $user object within the panel. Unfortunately I don't know how to include this within the panel.
I hope I made it a bit clearer now and hope you can help me out.
thanks and regards,
Hauke
Comment #3
hawkster commentedComment #4
michelleOh, that's just a place for the user to put their real name. If you don't need that, just delete the field.
Michelle
Comment #5
hawkster commentedYes, I know, that this is just the place for a user to put the real name in. And I know how to delete it.
I want to display the username within the "All about user" panel, but I don't want the user to enter two names. One "Username" and one "Real Name". I only want one(!) field "Name" at registration (by default this is the username of the user module).
I have two aproaches how to achieve this, but none of them work so far.
1) I could load the "username" (from user module) into the panel and display it in the profile. But I don't know how to access "username" from the panel.
2) I could copy the username into the cck field "name" and display this within the panel. But there is the problem, how to copy it on registration and not only after editing the profile for the first time.
I don't know how to explain it more clearly.
cheers,
Hauke
Comment #6
michelle#1:
Michelle
Comment #7
hawkster commentedMichelle,
thanks for this piece of code. It helped me to solve my problem.
For those who are having a similar request here a short description of how it managed it.
I used the posted code and combined it with the code, which is needed for a "computed field" to assign values. I am not storing it to the database anymore. The Username is loaded directly from the $user object now. This is the code for the computed field "Name":
THanks and regards,
Hauke
Comment #8
droople commentedAnother way, I hope I interpreted this issue correctly.
go to admin/panels/panel-page/userprofile/edit/general
then go to Content Tab
Configure "All about user pane" ,
Override Title
Paste this
%user's Pagethis gives Username's PageAlso note on the uprofile node type, I used Autonode_titles module to replace the title field with "the username-raw"
I hope this also helps
Thanks
Comment #9
giorgio79 commentedThanks for the tip!
username-raw does not seem to be an option for me, only user-name, and that one if for the currently logged in user, any other idea?
Comment #10
giorgio79 commentedEh, it turns out this is some kind of Panels bug
http://drupal.org/node/263551
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #12
doublejosh commentedI've also used auto node title to set the uprofile title (an unfortunate node necessity.) HOWEVER, when a user registers if they don't even proceed to the user profile to hit submit, then the title is never set causing an error.
Also, name in the registration form (from bio) won't save upon registration.